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.
Example 1
Input: citations = [0,1,3,5,6]
Output: 3
Explanation: Three papers (3,5,6) each have >= 3 citations, and no 4 papers have >= 4.
Example 2
Input: citations = [0]
Output: 0
Explanation: The single paper has 0 citations, so the h-index is 0.
Example 3
Input: citations = [1,1,1]
Output: 1
Explanation: All three papers have at least 1 citation, but none has 2, so h = 1.
Since the array is sorted ascending, if citations[mid] >= n - mid then all n-mid papers from mid onward have at least n-mid citations, giving an h-index of at least n-mid — so search left for an even larger h. Otherwise search right. The answer is n minus the final left boundary.
Run checks all cases above. Submit evaluates all test cases.