Stone Removal Game
Your DSA round on this problem
The interviewer starts you on this exact problem: clarify it, explain your approach, code while you talk and answer the follow-ups. Your code runs on hidden tests, and you get a scored report.
95 coins for a 45-minute round· new accounts get 100 coins free
Practise it on your own
Write your solution, run it on the examples and submit it against the hidden tests. No interviewer, and it's free.
The problem
Alice and Bob are playing a game with a single pile of n stones. They take turns making moves, and Alice goes first.
On the very first turn, Alice must remove exactly 10 stones from the pile. On every turn after that, the current player must remove exactly one stone fewer than the number of stones removed on the previous turn.
If a player does not have enough stones left in the pile to make their required move, they lose the game. Assuming both players follow the rules, determine if Alice will win.
Example 1
Input: n = 12
Output: true
Example 2
Input: n = 1
Output: false
Example 3
Input: n = 10
Output: true
Example 4
Input: n = 19
Output: false
Example 5
Input: n = 27
Output: true
Example 6
Input: n = 34
Output: false
Example 7
Input: n = 50
Output: true
Constraints
1 <= n <= 50