Tap here to switch tabs
Problem
Submissions

Problem: Stone Game IX

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

Statement

Alice and Bob take turns playing a game, with Alice going first. You are given an integer array stones.

On each turn, the active player removes any stone from stones. A player loses immediately if the sum of the values of all removed stones so far is divisible by 33. If all stones are removed and the total sum of removed stones is never divisible by 33, Bob wins.

Assuming both players play optimally, return true if Alice wins, or false if Bob wins.

Constraints:

  • 1≤1 \leq stones.length ≤105\leq 10^5

  • 1≤1 \leq stones[i] ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Stone Game IX

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

Statement

Alice and Bob take turns playing a game, with Alice going first. You are given an integer array stones.

On each turn, the active player removes any stone from stones. A player loses immediately if the sum of the values of all removed stones so far is divisible by 33. If all stones are removed and the total sum of removed stones is never divisible by 33, Bob wins.

Assuming both players play optimally, return true if Alice wins, or false if Bob wins.

Constraints:

  • 1≤1 \leq stones.length ≤105\leq 10^5

  • 1≤1 \leq stones[i] ≤104\leq 10^4