Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- mysql
- PCA
- 혼자 공부하는 SQL
- 멀티스레딩
- Til
- SQL
- WIL
- 퓨처셀프
- 백준
- 프로그래머스
- 미래혁신대전
- 1463
- Stored Procedure
- 2023
- computer science
- 엘런 튜링
- MVT
- 덴드로그램
- Django
- FastAPI
- Programmers
- Recommender system
- 다시 왔다!
- stored function
- CS
- 선형대수
- JP Study
- 컴퓨터 과학이 여는 세계
- 문제풀이
- 한 권으로 읽는 컴퓨터 구조와 프로그래밍
Archives
- Today
- Total
Growth Hoon
20231027_TIL_프로그래머스 본문
def solution(k, scores):
answer = []
hof = []
for score in scores:
if len(hof) >= k:
if min(hof) > score: # 명예의 전당에서 최소값이 더 큰 경우
answer.append(min(hof))
else: # 명예의 전당에서 최소값이 더 작은 경우
min_index = hof.index(min(hof))
del hof[min_index]
hof.append(score)
answer.append(min(hof))
else:
hof.append(score)
answer.append(min(hof))
return answer