FastPrepH-Index II
Problems/H-Index II

H-Index II

Goldman Sachs logoGoldman Sachs● MediumFULLTIMEONSITE INTERVIEW

Updated Sep 2026

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 Onsite Interview questions

  • Best Average Student ScorePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Knight Probability in ChessboardONSITE INTERVIEW · Seen Nov 2026
  • Meeting RoomsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Minimum Meeting Rooms Without a Sweep LineONSITE INTERVIEW · Seen Oct 2026
  • First Non-Repeating CharacterPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Root of the Largest TreePHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Dungeon HealthONSITE INTERVIEW · Seen Sep 2026
  • Insert, Delete, And Get Random In Constant TimeONSITE INTERVIEW · Seen Sep 2026
  • Least Recently Used CacheONSITE INTERVIEW · Seen Sep 2026
  • Staircase Search In A Sorted MatrixONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Minimum Number of Days to Make m BouquetsPhonePe · ONSITE INTERVIEWPhonePe interview questions
  • Count Winning Dice Face PairsGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Search in a Rotated Sorted ArrayAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Search a Row- and Column-Sorted MatrixByteDance · ONSITE INTERVIEWByteDance interview questions
  • 3Sum SmallerSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Smallest Batch Size Within a Step LimitMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Peak of an Increasing-Then-Decreasing ArraySnap Inc. · ONSITE INTERVIEWSnap Inc. interview questions
  • Online Meeting Scheduler with Fixed RoomsUber · ONSITE INTERVIEWUber interview questions
  • Search a 2D MatrixWhatNot · PHONE SCREEN · ONSITE INTERVIEWWhatNot interview questions
  • Search in Rotated Sorted ArrayKotak Mahindra Bank · ONSITE INTERVIEWKotak Mahindra Bank interview questions
All Goldman Sachs interview questionsSee Goldman Sachs hiring insights
Saved
class Solution {
    public int hIndexSorted(int[] citations) {
      // write your code here
    }
}
Checking account…