200. H-Index II
MediumBinary Search
Given an array of integers `citations` where `citations[i]` is the number of citations a researcher received for their `i`th paper and `citations` is sorted in **ascending order**, return the researcher's h-index. According to the definition of h-index: The h-index is the maximum value of `h` such that the given researcher has published at least `h` papers that have each been cited at least `h` times. You must write an algorithm that runs in logarithmic time.
Examples
Input: [0,1,3,5,6]
Output: 3
Explanation: Three papers (3,5,6) each have >= 3 citations, and no 4 papers have >= 4.
Constraints
- n == citations.length
- 1 <= n <= 10^5
- 0 <= citations[i] <= 1000
- citations is sorted in ascending order.
Loading...
Run checks all cases above. Submit evaluates all test cases.