#275
H-Index II
expert · 1040 · lc medium +32 · verified · 39.4% accepted · 529 likes · top 19%
Description
The array citations is sorted in non-descending order, where citations[i] is the citation count of paper i. Return the researcher's h-index: the maximum h such that at least h papers each have at least h citations.
Your algorithm must run in logarithmic time.
Example 1:
Input: citations = [0,1,3,5,6]
Output: 3
Explanation: [0,1,3,5,6] means the researcher has 5 papers in total and each of them had received 0, 1, 3, 5, 6 citations respectively.
Since the researcher has 3 papers with at least 3 citations each and the remaining two with no more than 3 citations each, their h-index is 3.
Example 2:
Input: citations = [1,2,100]
Output: 2
Code
1
2
3