FastPrepH-Index II
Problems/H-Index II

H-Index II

Goldman Sachs logoGoldman Sachs● MediumFULLTIMEONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: A Goldman Sachs superday report links the exact H-Index II exercise and says the test cases matched. This practice version is an approximately 99% match.

citations is sorted in nondecreasing order. Return the greatest integer h such that at least h papers each have at least h citations.

Your solution must run in O(log n) time.

Function

hIndexSorted(citations: int[]) → int

Examples

Example 1

citations = [0,1,3,5,6]return = 3

Three papers have at least three citations.

Example 2

citations = [1,2,100]return = 2

Two papers have at least two citations.

Constraints

  • 0 <= citations.length <= 100000
  • 0 <= citations[i] <= 10^9
  • citations is sorted in nondecreasing order.

More Goldman Sachs problems

  • House Robber IIIPHONE SCREEN · Seen Nov 2026
  • House Robber IIIPHONE SCREEN · Seen Nov 2026
  • Knight Probability in ChessboardONSITE INTERVIEW · Seen Nov 2026
All Goldman Sachs interview questionsSee Goldman Sachs hiring insights
Saved
class Solution {
    public int hIndexSorted(int[] citations) {
      // write your code here
    }
}
Checking account…