Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Stone Game II

Medium Game Theory

Piles of stones are arranged in a row. Starting with M = 1, on each turn a player takes the first X piles where 1 <= X <= 2M and then M becomes max(M, X). Alice moves first and both maximise their own stones. Print the maximum number of stones Alice can collect.

Constraints

1 <= n <= 100 1 <= piles[i] <= 10^4

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.