취준시절/프로그래머스
[프로그래머스] K번째 수 - Python
MAYMIN
2021. 7. 9. 01:12
728x90
SMALL
def solution(array, commands):
answer = []
for command in commands:
i=command[0]
j=command[1]
k=command[2]
tmp=array[i-1:j]
tmp.sort();
answer.append(tmp[k-1])
return answer
print(solution([1,5,2,6,3,7,4],[[2, 5, 3], [4, 4, 1], [1, 7, 3]]))
728x90
LIST