H-Index
Item citations[i] of the list citations is how many times a researcher's paper i was cited. The h-index is the largest number h such that at least h papers have h or more citations each.
Return the h-index.
Example 1
citations [3,0,6,1,5]
returns 3
Three papers (3, 6, 5) have at least 3 citations, but not four with 4, so h = 3.
Example 2
citations [0,0]
returns 0
h = 0.
Constraints
1 <= len(citations) <= 300 <= citations[i] <= 100
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Sorting and searching problems
- K Closest ValuesMedium
- Kth Smallest Pair SumMedium
- Least Truck CapacityMedium
- Merge IntervalsMedium
- Rebuild the LineMedium
- Smallest Divisor Under a LimitMedium
- Spread the TentsMedium
- The One Without a TwinMedium