Universities often rank a researcher with a single number called the h-index. The list citations has one entry for each paper of the researcher: citations[i] tells how many times paper i was cited.
To find the h-index, try a value h and ask: can I choose h papers so that each of them has at least h citations? The h-index is the biggest h for which the answer is yes. If no h above 0 works, the h-index is 0.
Return the h-index.
Examples
Example 1:
Input: citations = [4,4,0,1]
Output: 2
Explanation: Two papers (4 and 4) have at least 2 citations each. Three papers with at least 3 citations do not exist. So h is 2.
Example 2:
Input: citations = [10,8,5,4,3]
Output: 4
Explanation: Four papers (10, 8, 5 and 4) have at least 4 citations each. For h = 5, the paper with 3 citations is too low. So h is 4.
Example 3:
Input: citations = [0,0]
Output: 0
Explanation: No paper has any citation, so the h-index is 0.