Ctrl K

An Author's Impact Score

Medium
A researcher has published papers; cites[i] is how many times paper i has been cited. The author's impact score is the largest number h such that the author has at least h papers, each cited at least h times. Return the impact score.
Example 1
cites=[7, 2, 4, 9, 1, 4] → 4

Four papers have at least 4 citations each (7, 4, 9, 4), while only two have 5 or more. The answer is 4.

Example 2
cites=[0, 0, 0] → 0

No paper has been cited, so the score is 0.

Example 3
cites=[50] → 1
Constraints
  • 1 ≤ len(cites) ≤ 10⁵
  • 0 ≤ cites[i] ≤ 1000
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsHand-Rolled Sort MediumMost Snacks on a Budget MediumOne Rook per Line MediumStrength of the Weaker Partner EasyOut of Place in the Line Easy
loading Python…
Input
cites=[7, 2, 4, 9, 1, 4]
Expected
4

Run checks the first 3 tests in your browser. Submit checks all 81 tests on the server, hidden ones included.