Game Theory & Minimax
LC #877Medium
Stone Game
Game Theory & Minimax
Problem
Similar to Predict the Winner, but with an even number of piles and odd total number of stones. Determine if player 1 can win.
arraydynamic-programmingmathgame-theory
Constraints
- ›2 ≤ piles.length ≤ 500
- ›piles.length is even.
- ›1 ≤ piles[i] ≤ 500
- ›sum(piles[i]) is odd.
Example
Input
piles = [5, 3, 4, 5]Output
trueWhy
Alice takes 5, Bob takes 5, Alice takes 4, Bob takes 3. Alice 9 > Bob 8.