Programmers H-Index

Solution

def solution(citations):
    citations.sort()
    h = 0
    for i in range(max(citations)):
        a = len([x for x in citations if x >= i])
        if i <= a:
            h = i
    return h
  • 다른 사람 풀이
def solution(citations):
    citations.sort(reverse=True)
    answer = max(map(min, enumerate(citations, start=1)))
    return answer