h-index


  • 0
    S
    class Solution(object):
        def hIndex(self, citations):
            """
            :type citations: List[int]
            :rtype: int
            """
            i = j = 0
            for i,j in enumerate(sorted(citations,reverse=True),1):
                if j == i:
                    return i
                elif j < i:
                    return i - 1
            
            return i
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.