코테
[프로그래머스] <K번째수> 파이썬
SNNP
2021. 2. 13. 11:58
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 command in commands :
ans = array[command[0]-1:command[1]]
ans.sort()
answer.append(ans[command[2]-1])
return answer
정확성 테스트
테스트 1 〉 | 통과 (0.00ms, 10MB) |
테스트 2 〉 | 통과 (0.01ms, 10MB) |
테스트 3 〉 | 통과 (0.01ms, 10.1MB) |
테스트 4 〉 | 통과 (0.00ms, 10.2MB) |
테스트 5 〉 | 통과 (0.01ms, 10.1MB) |
테스트 6 〉 | 통과 (0.01ms, 10.2MB) |
테스트 7 〉 | 통과 (0.01ms, 10.1MB) |
채점 결과
정확성: 100.0
합계: 100.0 / 100.0