H-Index - Problem
Given an array of integers citations where citations[i] is the number of citations a researcher received for their i-th paper, return the researcher's h-index.
According to the definition of h-index on Wikipedia: The h-index is defined as 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.
Input & Output
Example 1 — Basic Case
$
Input:
citations = [3,0,6,1,5]
›
Output:
3
💡 Note:
The researcher has 3 papers with at least 3 citations each: papers with 6, 5, and 3 citations. The 4th paper has only 1 citation and 5th has 0, so h-index is 3.
Example 2 — All High Citations
$
Input:
citations = [1,3,1]
›
Output:
1
💡 Note:
Only 1 paper has at least 1 citation, and only 1 paper has at least 3 citations. The h-index is 1 since we have at least 1 paper with ≥1 citations.
Example 3 — All Zero Citations
$
Input:
citations = [0,0]
›
Output:
0
💡 Note:
No papers have any citations, so the h-index is 0.
Constraints
- 1 ≤ citations.length ≤ 5000
- 0 ≤ citations[i] ≤ 1000
Visualization
Tap to expand
Understanding the Visualization
1
Input
Array of citation counts for each paper
2
Process
Find maximum h satisfying the h-index condition
3
Output
The h-index value
Key Takeaway
🎯 Key Insight: H-index is the largest number h such that you have at least h papers with h or more citations each
💡
Explanation
AI Ready
💡 Suggestion
Tab
to accept
Esc
to dismiss
// Output will appear here after running code