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
H-Index Problem: citations [3,0,6,1,5] → h-index = 3Input Citations30615H-Index AnalysisPapers ≥ 3 citations: 3 papers ✓Papers ≥ 4 citations: 2 papers ✗Maximum h = 3Green papers (6,3,5) have ≥3 citationsRed papers (0,1) have <3 citations3H-Index = 3
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
Asked in
Google 25 Facebook 20 Amazon 15
28.0K Views
Medium Frequency
~15 min Avg. Time
892 Likes
Ln 1, Col 1
Smart Actions
💡 Explanation
AI Ready
💡 Suggestion Tab to accept Esc to dismiss
// Output will appear here after running code
Code Editor Closed
Click the red button to reopen