Search
⌘K

Leetcode 292. Nim Game

Determine whether the first player can force a win in a two-player game where players alternately remove 1–3 stones from a heap under optimal play. The core observation is that positions with n % 4 == 0 are losing for the starter, while all others are winning.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.