Tap here to switch tabs
Problem
Submissions

Problem: Stone Removal Game

med
30 min
Try to solve the Stone Removal Game problem.

Statement

Alice and Bob are playing a game with a pile of n stones, with Alice taking the first turn.

On each turn, a player must remove a specific number of stones from the pile:

  • On the first turn, the player must remove exactly 1010 stones.

  • On each subsequent turn, the current player must remove exactly 11 fewer stone than the number of stones removed in the previous turn.

The game ends when a player is unable to make a valid move because there are not enough stones left in the pile. That player loses the game.

Given the integer n, return true if Alice wins the game assuming both players play optimally, or false otherwise.

Constraints:

  • 1≤1 \leq n ≤50\leq 50

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Stone Removal Game

med
30 min
Try to solve the Stone Removal Game problem.

Statement

Alice and Bob are playing a game with a pile of n stones, with Alice taking the first turn.

On each turn, a player must remove a specific number of stones from the pile:

  • On the first turn, the player must remove exactly 1010 stones.

  • On each subsequent turn, the current player must remove exactly 11 fewer stone than the number of stones removed in the previous turn.

The game ends when a player is unable to make a valid move because there are not enough stones left in the pile. That player loses the game.

Given the integer n, return true if Alice wins the game assuming both players play optimally, or false otherwise.

Constraints:

  • 1≤1 \leq n ≤50\leq 50