You are given an array `citations` where `citations[i]` is how many times a researcher's i-th paper has been cited. Return the researcher's h-index: the largest h such that the researcher has at least h papers that were each cited at least h times.
You are given an array citations where citations[i] is how many times a researcher's i-th paper has been cited. Return the researcher's h-index: the largest h such that the researcher has at least h papers that were each cited at least h times.
Example 1:
Input: {"citations":[3,0,6,1,5]}
Output: 3
Constraints:
n==citations.length
1≤n≤5000
0≤citations[i]≤1000
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"citations":[3,0,6,1,5]}
n
5
candidate h
-
citations[i]
-
h-index
?
Papers in input order
3001621354
5 papers, one bar each. We want the largest h with at least h bars reaching height h.