Problem
A researcher has published n papers, and citations[i] says how many times paper i has been cited. Their h-index is the largest number h such that **at least h papers have h or more citations each**. Return it.
Example 1
- Input
- citations = [4, 0, 7, 2, 5]
- Output
- 3
- Why
- 4, 7 and 5 each have at least 3
Example 2
- Input
- citations = [2, 9, 2]
- Output
- 2
Example 3
- Input
- citations = [0, 0]
- Output
- 0
Constraints
1 <= citations.length <= 50000 <= citations[i] <= 1000