Description
Given citations array, return the researcher's h-index: the maximum h such that h papers have at least h citations each.
Examples
Input:
citations = [3,0,6,1,5]Output:
3Explanation:
3 papers with ≥3 citations.
Input:
citations = [10,10,10,10,10]Output:
5Explanation:
All 5 papers have at least 5 citations, but it is possible to't have more than 5 papers with at least 6 citations since there are only 5 papers total. Therefore, h-index is 5.
Input:
citations = [100]Output:
1Explanation:
Even though the single paper has 100 citations, it is possible to only have at most 1 paper with at least 1 citation. Therefore, h-index is 1.
Constraints
- •
1 ≤ n ≤ 5000