2025-12-24 12:18:23 +0300 MSK
H-Index II
Links
Code
class Solution:
def hIndex(self, citations: List[int]) -> int:
left, right = 0, len(citations) - 1
h = 0
while left <= right:
mid = left + (right - left) // 2
count = len(citations) - mid
val = citations[mid]
h = max(h, min(count, val))
if count >= val:
left = mid + 1
else:
right = mid - 1
return h