Search
⌘K

Leetcode 1908. Game of Nim

Given several piles of stones and rules for how many stones can be removed each turn, determine whether the first player can force a win (or produce a winning move) under optimal play; model it as an impartial game and use nim-sum/Grundy numbers — a nonzero xor of pile Grundy values implies a winning position.


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.