Compute a Researcher's H-Index From Citation Counts
Last updated: November 29, 2026
Quick Overview
Given the citation counts of a researcher's papers, return their h-index: the largest h such that at least h papers have at least h citations each.
0
0
0 solved
Given the citation counts of a researcher's papers, return their h-index: the largest h such that at least h papers have at least h citations each.
A natural Google phone screen question because Google Scholar shows the h-index on every profile. The interviewer looks for either a sort-based or an O(n) counting-bucket solution and checks that you handle citations larger than the paper count.
What the Interviewer Expects
- States the definition precisely and checks it on an example
- Gives an O(n log n) sort-and-scan solution
- Improves to O(n) with buckets capped at n
- Handles all-zero citations and very large counts
- Explains why h can never exceed n
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Citations arrive already sorted ascending; can you do it in O(log n)?
- Maintain the h-index as new citations stream in.
- Compute the i10-index or g-index too; what changes?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
- Input: list
citationsof non-negative integers, one per paper. - Output: the h-index.
- Example:
[3, 0, 6, 1, 5]gives 3, since three papers have at least 3 citations and there are not four with...
High-Level Design
Sorting descending and finding the last position i where citations[i] >= i + 1 gives O(n log n). For O(n), note h is at most n. Create buckets 0..n where bucket k counts papers with exactly k citati...