Reported September 2024
Goldman Sachs

Get Min Moves

Reported by candidates from Goldman Sachs's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Goldman Sachs OA. Under 2s to a working solution.
Founder's read

Goldman Sachs asked this in September 2024 and it's a deceptively simple optimization problem that trips up candidates who overthink it. You're given some state and need to find the minimum number of moves to reach a target. The trick is recognizing whether this is a BFS shortest-path problem, a math/greedy calculation, or a dynamic programming search. Most candidates waste 10 minutes trying to brute force when there's a clean pattern. StealthCoder will catch the pattern instantly if you blank on the approach during the live OA.

Pattern and pitfall

Without the full problem text, the title 'Get Min Moves' signals a shortest-path or state-space search. The candidates reporting this likely faced either a graph traversal (BFS to find shortest path), a math formula (greedy sequence of operations), or a DP table (minimum cost to transform state A into state B). Goldman Sachs typically tests whether you know which tool to pick. The pitfall is coding a DFS or recursive solution when BFS would solve it in linear time, or trying DP when the answer is a closed-form formula. On game day, if you blank, StealthCoder reads the constraints and spots the pattern before you even finish parsing. That 30-second hedge is often the difference between passing and timing out.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Get Min Moves cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Goldman Sachs's OA.

Goldman Sachs reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Get Min Moves FAQ

Is this a graph problem or a math problem?+

Depends on the input structure. If you're moving between discrete states (like a puzzle or board), it's BFS. If you're applying operations (like swaps or increments), check if there's a formula first. Goldman Sachs mixes both. Read the constraints carefully. Fewer than 10^5 moves usually means math. Larger state spaces usually mean BFS.

What's the most common mistake?+

Recursion without memoization, or memoization without recognizing the state space is too large. Candidates also miss that some moves can be 'chained' or that operations are commutative. If swapping elements always converges the same way regardless of order, exploit that. Don't just code what comes to mind.

Should I use BFS or DP?+

BFS if you need the actual shortest path or the state graph is implicit. DP if you're filling a table of subproblems with known transitions. BFS is safer for 'minimum moves' because it guarantees optimality on unweighted graphs. Test on the examples first. If example output suggests you're counting hops, go BFS.

How do I solve this in 15 minutes?+

Parse the input, write down 2-3 example moves by hand, identify the pattern (linear, exponential, cycle). Code the shortest-path or greedy solution for your pattern. Don't overthink edge cases initially. Get a working solution, then optimize. Goldman Sachs grades on correctness first.

What if I don't recognize the pattern during the OA?+

Write a BFS solution. It works on any state-space problem and is O(V+E). It's rarely the slowest approach on Goldman's OAs and buys you full credit. Then optimize if you have time. Never leave a question blank.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Goldman Sachs.

OA at Goldman Sachs?
Invisible during screen share
Get it