Goldman Sachs Coding Interview Questions
26 Goldman Sachs coding interview problems with full optimal solutions — 17 easy, 9 medium, 0 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Goldman Sachs interviewer values, and a FAQ section.
Showing 9 problems of 26
- #7mediumcompany favorite
7. Reverse Integer
Goldman Sachs loves Reverse Integer because it forces you to reason about 32-bit overflow without using a big-integer library. Reverse the digits of a signed integer and return 0 if the reversed value overflows the signed 32-bit range.
3 free resourcesSolve → - #8mediumcompany favorite
8. String to Integer (atoi)
Implement atoi: parse a string into a signed 32-bit integer, handling whitespace, sign, digits, and overflow clamping. Goldman Sachs uses atoi specifically because it grades how you handle edge cases — the spec has 5 rules and missing any of them is an instant downgrade.
2 free resourcesSolve → - #11mediumfrequently asked
11. Container With Most Water
Given heights, find two lines that together with the x-axis form the container with the most water. Goldman Sachs uses Container With Most Water to test the two-pointer technique and the proof that 'always move the shorter side' is correct.
2 free resourcesSolve → - #50mediumfrequently asked
50. Pow(x, n)
Compute x raised to the power n in O(log n). Goldman Sachs uses Pow(x, n) to test 'fast exponentiation' — the moment you say 'I'll square x repeatedly and use the binary representation of n' is the moment they decide to advance you.
3 free resourcesSolve → - #53mediumcompany favorite
53. Maximum Subarray
Find the contiguous subarray with the largest sum. Goldman Sachs uses Maximum Subarray to test whether you know Kadane's algorithm by name — the canonical O(n) DP that should come out from muscle memory.
3 free resourcesSolve → - #54mediumfrequently asked
54. Spiral Matrix
Return all elements of a matrix in spiral order. Goldman Sachs uses Spiral Matrix to test boundary-tracking discipline — the candidate who articulates the four shrinking boundaries before coding is the one who survives the edge cases.
2 free resourcesSolve → - #122mediumfrequently asked
122. Best Time to Buy and Sell Stock II
Multiple buy-sell transactions allowed, can hold at most one share at a time — what's the max profit? Goldman Sachs uses this immediately after the single-transaction variant to test whether you can recognize the 'sum of positive day-to-day deltas' trick.
2 free resourcesSolve → - #198mediumfrequently asked
198. House Robber
Maximize money robbed from a row of houses where you can't rob two adjacent ones. Goldman Sachs uses House Robber to test 'one-dimensional DP with two-state choice' — a recurring quant pattern dressed up as a brainteaser.
2 free resourcesSolve → - #204mediumcompany favorite
204. Count Primes
Count the number of primes less than a non-negative integer n. Goldman Sachs uses Count Primes as a sieve question — the candidate who reaches for the Sieve of Eratosthenes instead of trial-division gets the credit.
3 free resourcesSolve →
Related interview-prep guides
HackerRank Tech Interview Guide 2026: What It Tests, How It Tracks You, and the Modern Setup
HackerRank is still the volume leader in first-round technical screens for 2026 tech hiring. A browser-sandboxed coding environment that logs every keystroke, paste event, and tab-focus change inside its own tab. This guide covers what it tests, the boundary of what it can and cannot detect, and how a modern desktop setup pairs with a HackerRank session without leaking into the screen-share.
What to Wear to a Job Interview in 2026: The One-Notch-Above Rule, by Industry, Role, and Format
Dress one notch above the day-to-day attire of the team you're interviewing with. That's the 2026 rule. This guide breaks down what that means for tech, finance, sales, retail, and supervisor roles, plus what to wear to virtual and in-person interviews, common mistakes that quietly cost offers, and a 5-minute pre-interview attire check.
HireVue Alternatives in 2026: 6 Tools Compared (Candidate-Side Help for Async Video Interviews)
HireVue is an employer-side platform: companies use it to record and AI-score candidate answers. When candidates search for HireVue alternatives they usually mean candidate-side help, not a different employer tool. This guide compares 6 candidate-side options that work during a HireVue interview, ranked honestly against pricing, real-time speech support, coding support, and how visible they are to the recording.