Find the Winning Player in Coin Game

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.

Example 1
Inputx = 2, y = 7
Output"Alice"
The game ends in a single turn because Alice can pick 1 coin with value 75 and 4 coins with value 10, leaving Bob unable to move.
Example 2
Inputx = 4, y = 11
Output"Bob"
The game ends in 2 turns because Alice and Bob can each pick 1 coin with value 75 and 4 coins with value 10, leaving Alice unable to move next.

Constraints

  • 1 <= x, y <= 100

Asked at 1 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate