Stone Game IX
A medium-tier problem at 29% community acceptance, tagged with Array, Math, Greedy. Reported in interviews at Samsung and 0 others.
Stone Game IX is the kind of problem that looks like a simulation but punches you in the face the moment you try to brute force it. It's asked by Samsung and sits at a 29% acceptance rate, which tells you the obvious approach fails hard. The trick isn't coding a game tree or minimax. It's recognizing a pattern in how stones divide into groups by their remainder modulo 3, then using greedy logic to determine who wins before playing a single stone. If this hits your live assessment and you're stuck on game state recursion, StealthCoder surfaces the mathematical insight in seconds, invisible to the proctor.
Companies that ask "Stone Game IX"
Stone Game IX 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 an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.
Get StealthCoderThe problem hinges on counting stones by remainder (mod 3) rather than simulating moves. You'll see candidates waste time building recursive game states with memoization when the actual solution is a few counting checks and comparisons. The pattern emerges when you realize the game state depends entirely on how many stones fall into remainder groups, not the order you take them. Most people fail because they treat it as a pure game-tree problem, missing that greedy counting dominates the outcome. When you understand the mod 3 distribution and which player benefits from it, the win condition becomes deterministic. Common pitfall: not recognizing that player 1 goes first and that changes which remainder counts matter. If you blank on the exact remainder logic during the OA, StealthCoder runs invisibly and delivers the counting rules and win condition you need.
Pattern tags
You know the problem.
Make sure you actually pass it.
Stone Game IX 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 an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Stone Game IX interview FAQ
Why doesn't recursion with memoization work here?+
Recursion works but is overkill. The game outcome is determined entirely by how stones split into mod 3 groups before any move happens. You're memoizing millions of states when a few counts and comparisons give the answer. The insight is mathematical, not computational.
What's the trick to this problem?+
Stones divide into three groups by remainder mod 3. Count how many fall into each group. Player 1 wins if the counts and their remainders satisfy a specific greedy condition. The trick is recognizing the game is decided before moves start, not during them.
Is this still asked at Samsung?+
Samsung is the only company in the data set that reports asking it. At 29% acceptance, it's a medium-difficulty filter, not a trivial warm-up. It rewards the few candidates who spot the pattern.
How does this relate to game theory?+
Game theory tells you to think about win/lose states and player turns. Here, game theory insight is that the first player has a deterministic advantage or disadvantage based on stone distribution. You're not running a full game tree; you're analyzing the initial position.
What's the common mistake on this problem?+
Treating it as a pure simulation or trying to minimax. Most failures come from either implementing a full game recursion or misunderstanding which remainder groups actually determine the winner. Counting and one greedy check is the real solution.
Want the actual problem statement? View "Stone Game IX" on LeetCode →