STUDY/Algorithm

[프로그래머스] LEVEL1 K번째수, python3

sinawi95 2019. 10. 15. 11:12
728x90

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