3222. Find the Winning Player in Coin Game
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:
- S: