[프로그래머스] K번째수 - Python
programmers.co.kr/learn/courses/30/lessons/42748 코딩테스트 연습 - K번째수 [1, 5, 2, 6, 3, 7, 4] [[2, 5, 3], [4, 4, 1], [1, 7, 3]] [5, 6, 3] programmers.co.kr def solution(array, commands): answer = [] for i in range(len(commands)): i, j, k = commands[i][0], commands[i][1], commands[i][2] tmp = sorted(array[i-1:j]) answer.append(tmp[k-1]) return answer
Algorithm/Programmers
2021. 2. 27. 21:01