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.

Google
Coding & Algorithms
Software Engineer
Google
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Medium

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
Counting Sort
Bucketing
Arrays
Sorting
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. 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 Problems
Sample Answer
Requirements
  • Input: list citations of 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...


Submit Your Answer
Markdown supported