개발/algorithm

[프로그래머스][level2] H-index - python

zzi_on2 2022. 3. 25. 17:07

문제 링크

풀이 

- len(citations)-index : h편 이상 인용된 논문의 수 

def solution(citations):  
    # 정렬 
    citations.sort()
    
    for index, h in enumerate(citations):
        # h번 이상 인용된 논문이 h편 이상 
        if h >= len(citations) - index :
            return len(citations) - index 
    return 0