LeetCode - The World's Leading Online Programming Learning Platform
The maximum value of the h-index is the length of citations. If the number of citations for any paper is less than the maximum value, the h-index will decrease.
h
, default is the the maxium h-index (the length of citations).h
, decrease the h
by 1.class Solution:
def hIndex(self, citations: List[int]) -> int:
citations.sort()
h = len(citations)
for c in citations:
if c >= h:
return h
h -= 1
return h