# [3222\. Find the Winning Player in Coin Game](https://leetcode.com/problems/find-the-winning-player-in-coin-game/) :::spoiler Solution ```cpp= class Solution { public: string losingPlayer(int x, int y) { int cnt = 0; while (x > 0 && y > 3) { x -= 1; y -= 4; ++cnt; } return cnt % 2 == 1 ? "Alice" : "Bob"; } }; ``` - T: $O(n)$ - S: $O(1)$ :::
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up