The condition
Now, if the array only contains 1's, then every time the player will choose it and make it zero. So, the answer will be dependent on the parity of n.
Else, the player getting a number > 1 for the first time wins the game.
Why
Suppose, a player gets a number
For Example consider the following cases
Case 1:
-
$[0, 1, 1, 1, 4, 5]$ Alice picks 3 -
$[0, 0, 1, 1, 4, 5]$ Bob is forced to pick 1 -
$[0, 0, 0, 1, 4, 5]$ Alice picks 1 -
$[0, 0, 0, 0, 4, 5]$ Bob is forced to pick 1 -
$[0, 0, 0, 0, 1, 5]$ Alice reaches a number with value$> 1$ again.
So, the above sequence of operation shows that Alice can always find some set of moves that results her to jump from a number
Case 2:
-
$[1, 1, 1, 4, 5]$ Alice picks 2 -
$[0, 1, 1, 4, 5]$ Bob is forced to pick 1 -
$[0, 0, 1, 4, 5]$ Alice picks 1 -
$[0, 0, 0, 4, 5]$ Bob is forced to pick 1 -
$[0, 0, 0, 1, 5]$ Alice reaches a number with value$> 1$ again.
Therefore, if there are even number of