When a game splits into independent subgames, we can solve each separately and combine with XOR. Each position has a Grundy number (nimber): 0 = losing, positive = winning. where mex = minimum excludant. For combined games: .
If XOR is 0, current player loses. This is advanced. For most LeetCode problems, simple win/lose DP suffices. Sprague-Grundy helps with complex game structures.