← All problemsSign in

1872. Stone Game VIII

LeetCodeArrayMathDynamic ProgrammingPrefix SumGame TheoryOpen on judge ↗

Alice and Bob take turns playing a game, with Alice starting first. There are n stones arranged in a row. On each player's turn, while the number of stones is more than one, they will do the following: - Choose an integer x > 1, and remove the leftmost x stones from the row. - Add the sum of the removed stones' values to the player's score. - Place a new stone, whose value is equal to that

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start