def solution(array, commands):
answer = []
for command in commands:
i,j,k = command[0],command[1],command[2]
slicelist = array[i-1:j]
slicelist.sort()
answer.append(slicelist[k-1])
return answer
def solution(array, commands):
return list(map(lambda x:sorted(array[x[0]-1:x[1]])[x[2]-1], commands))
'문제풀이 > 프로그래머스' 카테고리의 다른 글
[프로그래머스][Lv1] - [1차] 비밀지도 (Python) (0) | 2021.10.15 |
---|---|
[프로그래머스][Lv1] - 부족한 금액 계산하기(Python) (0) | 2021.10.14 |
[프로그래머스][Lv1] - 숫자 문자열과 영단어(Python) (0) | 2021.10.14 |
[프로그래머스][Lv1] - 로또의 최고 순위와 최저 순위(Python) (0) | 2021.10.12 |
[프로그래머스][Lv1] - 신규 아이디 추천(Python) (0) | 2021.10.12 |