MEDIUMasked at 1 company

Stone Game VII

A medium-tier problem at 58% community acceptance, tagged with Array, Math, Dynamic Programming. Reported in interviews at Dunzo and 0 others.

Founder's read

Stone Game VII is a medium-difficulty game theory problem that requires you to think recursively about optimal play between two competitors. It's been asked at Dunzo and sits at a 58% acceptance rate, which means half the people who see it in an assessment blank or submit wrong code. The trap isn't the logic, it's recognizing that you need dynamic programming to avoid recalculating the same game states over and over. If you hit this during a live OA and the greedy approach doesn't work, StealthCoder surfaces the correct DP formulation in seconds, invisible to the proctor.

Companies asking
1
Difficulty
MEDIUM
Acceptance
58%

Companies that ask "Stone Game VII"

If this hits your live OA

Stone Game VII 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. Built by a senior engineer who knows the OA is theater. This is the script.

Get StealthCoder
What this means

The core insight is that both players play optimally, and you need to track the maximum advantage (score difference) each player can achieve from a given subarray. The obvious greedy approach fails because a player might sacrifice immediate points to lock the opponent out of better future moves. You'll need a 2D DP table where the state represents a range of stones and whose turn it is. The recurrence relation must capture both players trying to maximize their own score relative to their opponent. Common mistakes include treating it like a simple max-subarray problem, forgetting to account for whose turn it is, or not recognizing that removing a stone from either end changes future game states fundamentally. If this pattern isn't in your muscle memory and you're stuck mid-assessment, StealthCoder recognizes the game-theory + DP signature and serves the working solution without drawing attention.

Pattern tags

The honest play

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

Stone Game VII 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. Built by a senior engineer who knows the OA is theater. This is the script. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Stone Game VII interview FAQ

Is Stone Game VII still asked in real interviews?+

Yes, though at a lower frequency than classic DP problems. It appears in assessments primarily as a medium-difficulty curveball, not as a screening problem. The 58% acceptance rate suggests it's designed to differentiate strong candidates from those who recognize standard patterns.

Why doesn't the greedy approach work here?+

Greedy assumes taking the highest-value stone is always optimal. Stone Game VII punishes that logic because a player might take a low-value stone to force their opponent into a worse position later. Both players play optimally with full knowledge of remaining stones, so you can't decide locally.

What's the relationship between this problem and Game Theory?+

This is a classic minimax problem. One player maximizes their score while the opponent minimizes it from the first player's perspective. Dynamic programming solves minimax by building up subproblems where the turn alternates, letting you compute the best outcome each player can force.

How do I know when to use DP for game problems?+

When both players play optimally and you're computing the best score/advantage from any game state, DP is the standard tool. If brute-force recursion would recalculate the same subarray under the same player's turn, memoization or tabulation will save you. Array constraints usually hint at this.

Can I solve this with just recursion and memoization?+

Yes. Memoization (top-down) works fine if you cache by (left, right, turn). Tabulation (bottom-up) is often cleaner for game problems because you build solutions in logical order. Both avoid the exponential blowup of raw recursion.

Want the actual problem statement? View "Stone Game VII" 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.