본문 바로가기
코딩테스트/프로그래머스

[프로그래머스] LV2 H-Index | 파이썬

by 애플파ol 2025. 5. 12.

Solution :

def solution(citations):
    citations.sort(reverse=True)  # 인용수 내림차순 정렬
    for idx, citation in enumerate(citations):
        # print(citation, idx)
        if citation <= idx: # idx번 이상 인용된 논문이 idx편 이상.
            return idx
    return len(citations) # for문 다 돌아도 안된다면, 최대 개수가 h_index.

 

 

Skills :

-