Medium

Quiz

#275 H-Index II

APPROACH

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
1 of 4
1:00

What is the optimal approach for this problem?