MEDIUMasked at 2 companies

Minimum Moves to Spread Stones Over Grid

A medium-tier problem at 44% community acceptance, tagged with Array, Dynamic Programming, Breadth-First Search. Reported in interviews at Guidewire and 1 others.

Founder's read

Minimum Moves to Spread Stones Over Grid is a medium-difficulty problem that sits at the intersection of grid mechanics and optimization. Asked by Guidewire and Geico, it requires you to figure out how to redistribute stones across a matrix with the minimum number of moves. The 44% acceptance rate isn't random. Most candidates either brute-force a wrong state space or miss the insight that transforms this from intractable into elegant. If you hit this on an OA and freeze, StealthCoder surfaces a working solution in seconds, invisible to the proctor.

Companies asking
2
Difficulty
MEDIUM
Acceptance
44%

Companies that ask "Minimum Moves to Spread Stones Over Grid"

If this hits your live OA

Minimum Moves to Spread Stones Over Grid is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.

Get StealthCoder
What this means

The trap is treating this as a pure greedy problem. You can't just move stones to their nearest empty spots; the global minimum requires exploring multiple valid configurations, which is why BFS and dynamic programming matter. Many solve it by representing grid state as a tuple and searching the state graph, but the bottleneck is pruning the search space efficiently. Array manipulation handles the stone positions, matrix traversal explores moves, and BFS finds the shortest path through valid states. The DP angle comes in when you realize memoization cuts exponential backtracking. StealthCoder is your hedge if the trick of state encoding or the BFS-DP hybrid doesn't click under pressure.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Minimum Moves to Spread Stones Over Grid recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Minimum Moves to Spread Stones Over Grid interview FAQ

Is this problem actually asked at Guidewire and Geico, or is that rumor?+

Confirmed. Both companies appear in the submission data. It's not a household-name FAANG problem, which means fewer online editorials and less community drilling. That's why the 44% acceptance rate is relatively low for a medium.

What's the trick most people miss?+

Treating it as a pathfinding problem instead of a state-space search. You're not moving one stone at a time; you're exploring which target configuration is reachable in the fewest steps. Encoding the entire grid state and using BFS to find the shortest path is the core insight.

How does BFS fit with dynamic programming here?+

BFS explores the state graph level by level, guaranteeing the shortest path. DP via memoization prevents revisiting the same grid configuration twice. Together, they avoid redundant work and exponential blowup. Without memoization, BFS alone can time out.

Do I need to understand matrix rotation or flipping?+

Not necessarily rotation, but you do need to manipulate the matrix and track positions accurately. Array iteration and swapping are core. The matrix part is more about representation and indexing than advanced transformations.

How much time should I budget if I don't recognize the pattern?+

If you're seeing it fresh, expect 20 to 30 minutes to land on state-space BFS. If you blank or start down a greedy path, you'll likely hit a wall. That's where having a safety net matters for the live OA.

Want the actual problem statement? View "Minimum Moves to Spread Stones Over Grid" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.