FastPrepSingle Number with Triplicates
Problems/Single Number with Triplicates

Single Number with Triplicates

Goldman Sachs logoGoldman Sachs● MediumFULLTIMEONSITE INTERVIEW

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A Goldman Sachs superday follow-up asks for the single value when every other value appears three times while preserving the base problem's time complexity. The report omits a standalone interface and bounds; this practice version is an approximately 98% match.

Given a nonempty integer array nums, every value appears exactly three times except for one value that appears once. Return that single value.

Your solution must run in O(n) time and use O(1) auxiliary space.

Function

singleNumberTriplicates(nums: int[]) → int

Examples

Example 1

nums = [2,2,3,2]return = 3

Only 3 occurs once.

Example 2

nums = [0,1,0,1,0,1,99]return = 99

Zero and one occur three times; 99 occurs once.

Constraints

  • 1 <= nums.length <= 300001
  • Every value fits in a signed 32-bit integer.
  • Exactly one value appears once; every other distinct value appears three times.

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

  • Find the Two Unique NumbersZomato / Eternal · ONSITE INTERVIEWZomato / Eternal interview questions
  • Smallest Sufficient TeamExpedia · ONSITE INTERVIEWExpedia interview questions
  • Bayesian Scenario ClassifierAmazon · ONSITE INTERVIEW
  • Maximum Unique-Character Word SubsetMeta · ONSITE INTERVIEWMeta interview questions
  • Largest Combination With Bitwise AND Greater Than ZeroMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Game of Life: In-Place Next GenerationGoogle · ONSITE INTERVIEWGoogle interview questions
  • 2048 Simulation and Board CodecCitadel · ONSITE INTERVIEWCitadel interview questions
  • SubsetsBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • BitFont - Maximum Non-Overlapping KerningStripe · ONSITE INTERVIEWStripe interview questions
  • Find the Value Occurring Exactly OnceMorgan Stanley · ONSITE INTERVIEWMorgan Stanley interview questions
All Goldman Sachs interview questionsSee Goldman Sachs hiring insights
Saved
class Solution {
    public int singleNumberTriplicates(int[] nums) {
      // write your code here
    }
}
Checking account…