728x90

나의 풀이
def solution(citations):
citations.sort(reverse=True)
for i, c in enumerate(citations):
if c <= i:
return i
return len(citations)
map과 min을 이용한 풀이
def solution(citations):
citations.sort(reverse=True)
answer = max(map(min, enumerate(citations, start=1)))
return answer
반응형
'Coding Test > Programmers' 카테고리의 다른 글
| [프로그래머스/파이썬] 소수 찾기 (0) | 2022.06.04 |
|---|---|
| [프로그래머스/파이썬] 모의고사 (0) | 2022.06.04 |
| [프로그래머스/파이썬] 가장 큰 수 (0) | 2022.06.03 |
| [프로그래머스/파이썬] K번째수 (0) | 2022.06.03 |
| [프로그래머스/파이썬] 이중우선순위큐 (0) | 2022.06.03 |