HARDasked at 1 company

Stone Game VIII

A hard-tier problem at 53% community acceptance, tagged with Array, Math, Dynamic Programming. Reported in interviews at Infosys and 0 others.

Founder's read

Stone Game VIII is a hard game-theory problem that asks you to optimize cumulative sums across an array under adversarial conditions. Infosys and other companies use it to filter for candidates who can model game states without blowing up time or space. The trick isn't just DP. You'll need to see that the optimal play collapses into a pattern once you strip away the noise. Most candidates either TLE on a naive recursive approach or miss the prefix sum insight entirely. If this hits your live OA and you blank on the reduction, StealthCoder surfaces a clean solution in seconds, invisible to the proctor.

Companies asking
1
Difficulty
HARD
Acceptance
53%

Companies that ask "Stone Game VIII"

If this hits your live OA

Stone Game VIII 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 an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage.

Get StealthCoder
What this means

The problem forces you to think in turns: each player picks consecutive stones, removes them, and adds their sum to their score. The naive DP recurrence feels natural but scales poorly because the state space explodes with different subarray combinations. The critical pattern: once you compute prefix sums, the choice at any game state depends only on whether the remaining prefix sum beats the opponent's score, not on the exact partition history. This transforms a 2D DP into a 1D greedy-like recurrence where you track only the current player's advantage. The acceptance rate (around 53%) reflects that many submissions fail or TLE because they don't recognize this compaction. StealthCoder is your hedge if you see the DP shape but miss the prefix-sum collapse during the timed assessment.

Pattern tags

The honest play

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

Stone Game VIII recycles across companies for a reason. It's hard-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 an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Stone Game VIII interview FAQ

Is Stone Game VIII actually a game-theory problem or just DP with a theme?+

Both. The game theory framing (two optimal players) is real, but solving it requires DP to compute best outcomes. You can't brute force all move sequences. The trick is recognizing that cumulative advantage, not individual moves, determines the winner once prefix sums are computed.

Why do people TLE on Stone Game VIII?+

Recursive DP without memoization or a state space that's too granular (tracking exact subarrays) both explode exponentially. The solution compresses the state to a 1D recurrence using prefix sums, reducing the complexity significantly. Most failed attempts don't see this compression.

Does Infosys ask this exact problem or variations?+

Infosys has reported asking Stone Game VIII. Variations on game theory and prefix sums appear across assessments. If your OA includes stone or game theory problems, this pattern shows up often enough to be worth drilling.

What's the core DP recurrence after you use prefix sums?+

Track dp[i] = the maximum advantage (difference in scores) the current player can achieve starting from index i. Each turn, the player picks a range and subtracts the opponent's future advantage. This 1D recurrence runs in O(n) or O(n^2) depending on your range logic, far faster than naive 2D DP.

How does this relate to other stone or game problems?+

Stone Game problems often use DP and game theory together. This one specifically rewards prefix-sum optimization, which is less obvious than the recursive game tree itself. If you've drilled Stone Game I or II, this one will feel like a leap in trick difficulty, not just complexity.

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