LeetCode 274, Medium. Topics: Array, Sorting, Counting Sort. View on LeetCode.
Generate this problem as a practice environment: tested reference solution, 26 parametrized pytest cases, and a playground notebook:
Problem
Given an array of integers citations where citations[i] is the number of citations a researcher received for their i<sup>th</sup> 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.
Examples
Constraints
- n == citations.length
- 1 <= n <= 5000
- 0 <= citations[i] <= 1000
Follow up: Could you solve it in O(n) time and O(n) extra space? What about an O(log n)-time solution after sorting, or O(n) time with O(1) space?
Solution
Reference implementation from solution.py on GitHub, full suite in test_solution.py:
Complexity
Last modified on September 7, 2026