The H-Index is a fascinating metric used to measure a researcher's academic impact! ๐
Given a sorted array of integers citations where citations[i] represents the number of citations a researcher received for their i-th paper, your task is to find their H-Index.
What is H-Index?
The H-Index is defined as the maximum value of h such that the researcher has published at least h papers that have each been cited at least h times.
The Challenge: Since the array is already sorted, you must write an algorithm that runs in O(log n) time - think binary search! ๐
Example: If a researcher has papers with citations [0, 1, 3, 5, 6], they have 3 papers with at least 3 citations each (papers with 3, 5, and 6 citations), so their H-Index is 3.
Input & Output
Constraints
- 1 โค citations.length โค 105
- 0 โค citations[i] โค 1000
- citations is sorted in non-decreasing order
- Follow up: This is a follow-up problem to H-Index, where citations is not sorted.