You are given two positive integers x and y, denoting the number of coins with values 75 and 10 respectively.
Alice and Bob are playing a game. Each turn, starting with Alice , the player must pick up coins with a total value 115. If the player is unable to do so, they lose the game.
Return the name of the player who wins the game if both players play
optimally.
Input: x =4, y =11Output: "Bob"Explanation:
The game ends in2 turns:* Alice picks 1 coin with a value of 75 and 4 coins with a value of 10.* Bob picks 1 coin with a value of 75 and 4 coins with a value of 10.
Each player must pick coins with a total value of 115. There are only two coin types: 75 and 10. The only possible ways to make 115 are:
1 coin of 75 and 4 coins of 10 (75 + 10*4 = 115)
0 coins of 75 and 11 coins of 10 (10*11 = 110, not enough)
2 coins of 75 and -35 coins of 10 (not possible)
0 coins of 75 and 11 coins of 10 (not possible)
So, the only way is to pick 1 coin of 75 and 4 coins of 10.
The game proceeds turn by turn. If at any turn, the player cannot pick 1 coin of 75 and 4 coins of 10, they lose. The number of turns possible is the minimum of x (number of 75 coins) and y // 4 (number of 10 coins divided by 4).
If the number of turns is odd, Alice wins (since she starts first), otherwise Bob wins.