Problems > Remove a Triangular Number > Editorial

Remove a Triangular Number — Solution & Editorial

Back to the Problem

Grundy DP: g[n] = mex of reachable Grundy values; non-zero means the first player wins.

Complexity: O(max n · moves)