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.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.