Clean python code


  • 0
    class Solution(object):
        def hIndex(self, citations):
            n = len(citations)
    
            low, high = 0, n - 1
            while low <= high:
                mid = low + high >> 1
                if citations[mid] < n - mid:
                    low = mid + 1
                else:
                    if mid == 0 or citations[mid - 1] < n - mid + 1:
                        return n - mid
                    high = mid - 1
            return 0

Log in to reply
 

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