Remove a Square Number — Solution & Editorial
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)
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)