class Solution:
def hIndex(self, citations):
"""
:type citations: List[int]
:rtype: int
"""
citations.sort()
n = len(citations)
l=0
r=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 274. H-Index
最新推荐文章于 2025-01-04 10:10:24 发布
本文深入探讨了计算研究人员论文引用H指数的高效算法。通过排序和二分查找技术,该算法能够在O(log n)的时间复杂度内找到作者最具影响力的论文数量。详细介绍了算法的实现过程,包括关键步骤和代码示例。

847

被折叠的 条评论
为什么被折叠?



