class Solution:
def hIndex(self, citations):
"""
:type citations: List[int]
:rtype: int
"""
n = len(citations)
l,r=0,n-1
h = 0
while l<=r:
mid=l+(r-l)//2
h = max(h,min(citations[mid],n-mid))
if citations[mid]<n-mid:
l=mid+1
else:
r=mid-1
return h
python leetcode 275. H-Index II
最新推荐文章于 2024-09-13 19:41:31 发布