-
42747. H-IndexAlgorithm/Programmars 2023. 3. 20. 15:15
def solution(citations): answer = 0 citations.sort(reverse=True) h = citations[0] for h in range(citations[0], 0, -1): cnt_up = 0 for c in citations : if c >= h : cnt_up += 1 if cnt_up >= h : answer = h break return answer 처음에는 문제 그대로 풀이하였다. 근데 이중 for문이 맘에 안 들었고, 다른 풀이 방법이 있을 것 같았다. def solution(citations) : citations.sort() l = len(citations) for i in range(l) : if citations[i] >= l-i : return ..