3511. Find the Winning Player in Coin Game
My accepted Python solution to LeetCode problem 3511, Find the Winning Player in Coin Game, running in 0ms.
- Difficulty: Easy
- Python
- Runtime 0ms
- Memory 17.6MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 0ms, memory 17.6MB, accepted 2025-12-31.
class Solution:
def winningPlayer(self, x: int, y: int) -> str:
# Each turn: pick 1 coin of 75 and 4 coins of 10 (75 + 40 = 115)
# Count how many turns can be played
turns = min(x, y // 4)
# Alice plays on odd turns (1, 3, 5, ...), Bob on even turns (2, 4, 6, ...)
# If turns is odd, Alice wins. If turns is even (including 0), Bob wins.
if turns % 2 == 1:
return "Alice"
else:
return "Bob"