Top 15 Goldman Sachs Coding Interview Problems: What Each Teaches
- GS difficulty skews harder than most finance firms at 13% hard, so skipping hard problems in prep will leave you exposed at Superday.
- Sliding window is tested at both medium and hard level (LC 209 and LC 76), meaning you need the HashMap satisfied-count technique cold before you walk in.
- Simulation problems (Game of Life, Robot Bounded in Circle, Knight Probability) form a GS-specific cluster that standard FAANG prep largely ignores.
- Fraction to Recurring Decimal (LC 166) is the most finance-specific ask on the list, confirmed in 2025 Superday reports with a 21.6% acceptance rate.
- BFS on abstract state spaces (Open the Lock, Kill Process) appears more at GS than elsewhere, testing whether you recognize a graph problem without a visual graph.
- LRU Cache (LC 146) goes further at GS: you must justify the doubly linked list before coding and be ready for an LFU follow-up.
Most candidates prep for Goldman Sachs coding interview problems exactly the way they prep for Google. Same Neetcode 150, same strategy, same quiet confidence walking in the door. That's a mistake. GS tests simulation problems you won't see at Meta, asks finance-flavored math that pure tech companies don't touch, and actively scores edge case handling as a dimension, not a bonus.
You can walk out of a GS Superday having solved the problem correctly and still not get an offer. The bar isn't just "did you get it right." It's "did you get it right, handle all the edge cases, explain the tradeoffs unprompted, and not visibly panic when they pushed back."
The GS Interview Has Two Coding Stages
The process starts with a HackerRank OA: 90 minutes, two DSA problems (one easy, one medium), plus multiple-choice questions on algorithms and OOP. Pass that and you reach Superday, where two or three back-to-back rounds each run a DSA problem on a shared editor.
Difficulty distribution is roughly 33% easy, 53% medium, and 13% hard. That hard fraction is higher than you'd expect from a finance firm. GS occasionally surprises candidates with Median of Two Sorted Arrays or Minimum Window Substring when they came in expecting smooth mediums.
Three Ways Goldman Sachs Tests Differently
Finance-flavored problems appear at a higher rate. Stock prices, fraction representation, probability-based DP. GS wants to see whether you can reason about numeric precision and decimal cycles, not just arrays and trees.
Simulation and geometry form a distinct cluster. Game of Life, Robot Bounded in Circle, Knight Probability. Most companies don't heavily test this group. Candidates who ran only standard FAANG prep often don't see it coming. It's like spending three months studying for a chemistry exam and finding out half the test was physics.
Edge case handling is a scored dimension. Overflow, negative numerators, zero-division, and empty inputs get probed explicitly. Getting the algorithm right isn't enough if your solution collapses the moment the interviewer asks "what if the input is negative?"

500 LeetCode problems solved. Goldman Sachs asks about recurring decimals and knight probability.
The 15 Goldman Sachs Coding Interview Problems
| # | Problem | LC | Difficulty | Pattern |
|---|---|---|---|---|
| 1 | Trapping Rain Water | 42 | Hard | Two Pointers |
| 2 | LRU Cache | 146 | Medium | Design |
| 3 | Fraction to Recurring Decimal | 166 | Medium | Math / HashMap |
| 4 | Game of Life | 289 | Medium | Simulation |
| 5 | Minimum Size Subarray Sum | 209 | Medium | Sliding Window |
| 6 | Product of Array Except Self | 238 | Medium | Prefix Product |
| 7 | Robot Bounded in Circle | 1041 | Medium | Math / Simulation |
| 8 | Knight Probability in Chessboard | 688 | Medium | DP / Probability |
| 9 | Open the Lock | 752 | Medium | BFS on State Graph |
| 10 | Kill Process | 582 | Medium | Tree / BFS |
| 11 | Search a 2D Matrix II | 240 | Medium | Staircase Search |
| 12 | Minimum Window Substring | 76 | Hard | Sliding Window |
| 13 | Number of Islands | 200 | Medium | Graph BFS / DFS |
| 14 | Median of Two Sorted Arrays | 4 | Hard | Binary Search |
| 15 | High Five | 1086 | Easy | Heap |
1. Trapping Rain Water (LC 42)
The highest-frequency confirmed problem in GS data. Two approaches work: precomputed max arrays in O(n) time and O(n) space, or the two-pointer approach in O(1) space. GS interviewers specifically push for the O(1) space version. The key insight: whichever side has the lower running maximum is the constraining factor, so you can safely process that side without knowing the other side's exact max.
2. LRU Cache (LC 146)
A Superday staple, and GS goes further than just asking you to code it. You need to explain why the doubly linked list exists before you start. A singly linked list can't support O(1) deletion because you can't reach the predecessor node. Sentinel head and tail nodes eliminate nil checks. The HashMap maps keys directly to list nodes. Expect a follow-up asking you to extend it to LFU. Full walkthrough in the LRU cache implementation guide.
3. Fraction to Recurring Decimal (LC 166)
The most GS-specific problem on the list. A 21.6% acceptance rate, confirmed in 2025 candidate reports, and thematically perfect for a firm that lives and dies by decimal precision. The recurring decimal forms when the same remainder appears twice in long division. Track remainders in a HashMap with their digit positions to detect the cycle. The trap: a negative numerator with a positive denominator requires explicit sign handling. Most candidates forget it. GS does not.
4. Game of Life (LC 289)
Update the board in place without O(m*n) extra space. The trick is encoding the next state inside the current cell value. A live cell that will die becomes 2. A dead cell that will revive becomes -1. After counting neighbors using the original values, a second pass reads the encoded states and applies the transition. GS favors problems where the naive approach wastes space and the better one doesn't.
5. Minimum Size Subarray Sum (LC 209)
A clean sliding window problem and one of the more common OA asks. The window expands right until the sum hits the target, then contracts from the left while the sum still meets it. Track the minimum valid window length throughout. GS interviewers sometimes ask for the O(n log n) follow-up using prefix sums and binary search. The sliding window algorithm guide covers both variants.
6. Product of Array Except Self (LC 238)
No division allowed. Everyone's first instinct is to divide the total product by each element. That instinct fails spectacularly on zeros. The correct approach builds a left-to-right prefix product array, then sweeps right-to-left with a running suffix product. This runs in a single output array if you order the passes correctly. GS uses this problem to check whether you reach for the invalid approach first, because almost everyone does.
7. Robot Bounded in Circle (LC 1041)
The robot returns to its start if after one full cycle it's at the origin or not facing north. That second condition is the non-obvious one. If the robot finishes facing south, east, or west, it'll loop back in 2 or 4 cycles respectively. GS interviewers want you to derive this mathematically rather than confirm it with sample cases. "I'll just check a few examples and see" is not the answer they're looking for.

GS: "We just want to see how you think." Also GS: "Derive the cycle invariant for the robot mathematically, please."
8. Knight Probability in Chessboard (LC 688)
DP with probability. After k moves, what's the probability the knight is still on the board? You track probability mass at each cell rather than counting paths. Start with 1.0 at the origin and spread it across valid moves each step, discarding mass that falls off the board. This appears at GS more than at most companies because probability-based reasoning maps directly to how quants and engineers there think about risk.
9. Open the Lock (LC 752)
BFS on an abstract state space. States are four-digit combinations, transitions are single-digit increments or decrements. The key is recognizing this as BFS at all. The problem doesn't look like a graph problem on first read. GS tests whether you can translate "minimum moves" into level-by-level traversal without a visual graph to guide you. If you've only practiced BFS on grids with clearly labeled nodes, this will throw you off.
10. Kill Process (LC 582)
You're given a process tree as a flat parent array. Kill a target process and all its descendants. Build an adjacency list from the parent array, then BFS from the target. The input doesn't look like a tree. Candidates who can't convert between representations get stuck before they even identify what traversal to run.
11. Search a 2D Matrix II (LC 240)
A matrix where rows and columns are each sorted independently. Binary search per row runs in O(m log n). The optimal O(m+n) staircase search starts at the top-right corner. If the target is smaller than the current cell, move left. If larger, move down. Each step eliminates either an entire row or an entire column from consideration.
This appeared in a confirmed Superday report paired with LRU Cache. Two hard-medium problems back to back is exactly the kind of day GS Superdays are.
12. Minimum Window Substring (LC 76)
A confirmed Superday ask and the canonical hard sliding window problem. A character frequency map tracks what the window still needs, and a counter tracks how many distinct characters are fully satisfied. The window expands until the constraint is met, then contracts from the left. The tricky part is updating the satisfied counter correctly when a character's count crosses the threshold in either direction. Get the counter logic wrong and you'll produce a window that's either too large or invalid.
13. Number of Islands (LC 200)
The baseline graph problem at GS, present in both OA and Superday reports. Both BFS and DFS work. DFS is slightly simpler to implement; BFS avoids deep recursion on large grids. GS interviewers use this to confirm you can model a 2D grid as a graph and apply either traversal cleanly. Expect the follow-up: count islands with no edge cells touching the border.
14. Median of Two Sorted Arrays (LC 4)
Hard, infrequent, and confirmed in associate-level Superday reports. Most candidates produce the merge-and-find approach first. That's fine. Then the interviewer asks for better. The O(log(min(m,n))) binary search partitions both arrays simultaneously. You binary search on the smaller array to find a cut where max(left partition) is less than or equal to min(right partition) across both arrays. GS interviewers at senior levels push past the merge approach without apology.
15. High Five (LC 1086)
The most common OA opener. For each student ID, find the average of their top five scores. Use a min-heap of size 5 per student rather than sorting the full score list. A full sort is O(k log k) per student where k can be large. A bounded heap caps the work at O(k log 5) = O(k). This problem filters candidates who default to sorting when a constrained heap is cheaper. It's easy. That's why getting it wrong hurts more.
Where to Focus Your Prep
Sliding window is table stakes. Minimum Size Subarray Sum and Minimum Window Substring confirm GS tests both the medium and the hard version. You need the expanding-contracting pattern and the HashMap satisfied-count technique cold before you walk in.
BFS on abstract state spaces is a GS-specific ask. Open the Lock and Kill Process don't look like BFS problems until you abstract the state. If you've only practiced grid BFS, these will feel unfamiliar even if you know BFS perfectly well.
The simulation cluster is non-negotiable. Game of Life, Robot Bounded in Circle, and Knight Probability don't appear this heavily at most other companies. Treat them as mandatory. And treat Fraction to Recurring Decimal as near-certain prep given its 21.6% acceptance rate and confirmed 2025 Superday appearances.
Don't skip the hard problems entirely. At least two appear at senior and associate levels, and the difficulty split means roughly one in eight problems you'll see in a Superday is a hard.
For a full picture of the Goldman Sachs interview loop including the behavioral round, Superday structure, and system design expectations, see the Goldman Sachs software engineer interview guide.
If you want to practice these problems the way GS actually tests them, with an interviewer pushing back on edge cases and asking follow-ups mid-solution, SpaceComplexity runs voice-based mock interviews with rubric-based feedback that mirrors the Superday format.