본문 바로가기

Programming/Programmers

[프로그래머스/Python] K번째수(정렬)

def solution(array, commands):
    answer = []
    for i in commands:
        tmp = array[i[0]-1:i[1]]
        tmp.sort()
        answer.append(tmp[i[2]-1])
    
    return answer