thiagowfx's avatar

Β¬ just serendipity πŸ€ (not just serendipity)

LeetCode #274: H-Index

β€’ 31 words β€’ 1 min β€’ updated

LeetCode #274: H-Index:

python
class Solution:
    def hIndex(self, citations: List[int]) -> int:
        citations.sort(reverse=True)

        h = 0

        while h < len(citations):
            if h < citations[h]:
                h += 1
            else:
                break

        return h