Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
How can game theory help us solve this problem?
Think about the Sprague–Grundy theorem and the Colon Principle
The Grundy value of a node is the nim sum of the Grundy values of its children.