loading

H-Index — Step-by-Step Visualization

mediumLeetCode #274ArraySortingCounting Sort

Given an array of integers citations where citations[i] is the number of citations a researcher received for their ith paper, return the researcher's h-index. The h-index is defined as the maximum value h such that the researcher has published at least h papers with each cited at least h times.

Algorithm Pattern

Sort + Greedy Check

Key Idea

After sorting descending, h is the largest index+1 where citations[i] >= i+1.

Step-by-Step Approach

  1. Sort citations in descending order
  2. For each position i (1-indexed), check if citations[i-1] >= i
  3. h is the last position that satisfies this

Related Problems