H-Index

Problem Id: 274 Difficulty: Medium


Intuition

Solution


class Solution:
    def hIndex(self, citations: List[int]) -> int:
        citations.sort(reverse=True)
        h = 0
        for index in range(len(citations)):
            if index + 1 <= citations[index]:
                h = index + 1
            else:
                break
        return h