STUDY/Algorithm
[프로그래머스] LEVEL2 H-Index, python3, 정렬
sinawi95
2019. 11. 14. 09:18
728x90
문제가 이해가 안되었다. 질문하기에도 나랑 비슷한 사람들이 많아서 도움을 얻었는데 해당 테스트 케이스를 보니 이해가 갔다.
test case: [22, 42] return value:2
알고리즘 공부할때 문제를 읽고 이해하는 능력도 많이 중요한것 같다.
1차 시도
def solution(citations):
answer = 0
max_cit=max(citations)
for n in range(max_cit):
tmp=list(i for i in citations if i>=n)
length=len(tmp)
if n>length:
answer=n-1
break
return answer