Notice
Recent Posts
Recent Comments
Link
REC
프로그래머스 Lv.1: K번째 수 - Python 풀이 본문
SMALL
오늘의 문제
https://school.programmers.co.kr/learn/courses/30/lessons/42748
프로그래머스
SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr
내 풀이
def solution(array, commands):
answer = []
for command in commands: # commands 하나씩 살펴보자~
i = command[0]
j = command[1]
k = command[2]
tmp = array[i-1: j] # array의 i번째 수부터 j번째 수까지 slice
tmp.sort() # 정렬
answer.append(tmp[k-1]) # k번째 수를 answer에 append
return answer
문카클의 코테 스터디 4주차. 이번 주는 정렬입니다!
맛보기로 Level 1 풀어봤는데 너무 쉬워서 머쓱... 설명은 주석으로 대체할게요
LIST
'Algorithm' 카테고리의 다른 글
프로그래머스 Lv.1: 가장 많이 받은 선물 - Python 풀이 (0) | 2025.01.27 |
---|---|
프로그래머스 Lv.2: 가장 큰 수 - Python 풀이 (0) | 2025.01.26 |
프로그래머스 Lv.3: 이중우선순위큐 - Python 풀이 (0) | 2025.01.24 |
프로그래머스 Lv.2: 더 맵게 - Python 풀이 (0) | 2025.01.24 |
백준 2075번: N번째 큰 수 (S3) - Python 풀이 (0) | 2025.01.21 |