sorting 4 lines


  • 0
    Z
    def hIndex(self, citations):
        for i, v in enumerate(sorted(citations)[::-1] + [-1], 1):
            if v < i:
                return i - 1
        return 0

Log in to reply
 

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