Stone Removal Game - Problem
Alice and Bob are playing a game where they take turns removing stones from a pile, with Alice going first.
Alice starts by removing exactly 10 stones on her first turn. For each subsequent turn, each player removes exactly 1 fewer stone than the previous opponent.
The player who cannot make a move loses the game.
Given a positive integer n, return true if Alice wins the game and false otherwise.
Input & Output
Example 1 — Small Pile
$
Input:
n = 10
›
Output:
true
💡 Note:
Alice removes 10 stones and wins immediately since Bob cannot make any move (pile is empty).
Example 2 — Medium Pile
$
Input:
n = 25
›
Output:
false
💡 Note:
Alice removes 10 (15 left), Bob removes 9 (6 left), Alice needs 8 but only 6 available. Alice loses.
Example 3 — Large Pile
$
Input:
n = 100
›
Output:
true
💡 Note:
After several rounds: Alice=10+8+6+4+2=30, Bob=9+7+5+3+1=25. Alice can make more complete moves.
Constraints
- 1 ≤ n ≤ 105
Visualization
Tap to expand
Understanding the Visualization
1
Input
A pile of n stones
2
Game Rules
Alice starts with 10, then players alternate with decreasing amounts
3
Winner
Player who cannot make required move loses
Key Takeaway
🎯 Key Insight: The game follows a predictable arithmetic sequence pattern that can be solved mathematically
💡
Explanation
AI Ready
💡 Suggestion
Tab
to accept
Esc
to dismiss
// Output will appear here after running code