Problems > Staircase Nim > Editorial

Staircase Nim — Solution & Editorial

Back to the Problem

Staircase Nim reduces to ordinary Nim on the ODD-indexed stairs only: moving from an even stair is mirrored by the opponent, so only odd-stair coin counts matter. XOR them.

Complexity: O(N)