Problems > Remove a Fibonacci Number > Editorial

Remove a Fibonacci Number — Solution & Editorial

Back to the Problem

Compute Grundy values g[n] = mex of reachable positions' Grundy values up to the maximum query; g[n] ≠ 0 means the first player wins.

Complexity: O(max n · moves)