Matchstick Winner
Two players play a game with a stick of integer length n, where n >= 2.
A move has three steps:
- Cut the stick at an integer position
kwith1 <= k < n, producing two pieces of lengthskandn - k. - Discard one of the two pieces.
- Hand the remaining piece to the opponent.
A player who receives a piece of length 1 cannot cut it and loses immediately. Both players play optimally. Return true when the first player can force a win and false otherwise.
Examples
Input: 2
Output: true
Input: 3
Output: true
Hints
A player chooses which piece the opponent receives.
Handing over a piece of length 1 wins immediately, because the opponent cannot cut it.
For every `n >= 2` the cut `k = 1` produces a piece of length 1, so the first player always wins.
Related Problems
Matchstick Winner
Two players play a game with a stick of integer length `n`, where `n >= 2`.