Concise Python solution time complexity O(nlogn) space complexity O(1)


  • 0
    class Solution(object):
        def hIndex(self, citations):
            if citations == []: 
                return 0
            citations.sort(reverse=True)
            return max([min(i+1, citations[i]) for i in range(len(citations))])
    

Log in to reply
 

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