44ms python solution


  • 0
    C
    class Solution(object):
    def hIndex(self, citations):
        if not citations:
            return 0 
        citations.sort()
        citations.reverse()
        for i in range(len(citations)):
            if citations[i] >= i+1:
                continue
            else:
                return i
        return len(citations)

Log in to reply
 

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