Skip to content

Commit 8a65248

Browse files
committed
[PGS] K번째 수 / Level 1 / 5분(성공)
1 parent b5fd349 commit 8a65248

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def solution(array, commands):
2+
answer = []
3+
for i in range(len(commands)):
4+
start = commands[i][0]-1
5+
end = commands[i][1]
6+
k = commands[i][2]-1
7+
temp = array[start:end]
8+
temp.sort()
9+
answer.append(temp[k])
10+
return answer
11+
'''
12+
# 다른 코드
13+
def solution(array, commands):
14+
return [sorted(array[i-1:j])[k-1] for i,j,k in commands]
15+
'''

0 commit comments

Comments
 (0)