Skip to content

Practice Divisor Game

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1025
LeetCode Problem

Divisor Game

Problem Statement

Alice and Bob alternate turns, with Alice first. Given the current positive integer n, a move chooses a divisor x with 0 < x < n and replaces n by n - x. A player unable to move loses. Assuming optimal play, return whether Alice wins.

Source: Divisor Game on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
n = 2
Output
true

# Example 2

Input
n = 3
Output
false

Constraints

1 <= n <= 1000

Related LeetCode Problems

Practice more problems similar to Divisor Game.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.