About this question

Nim Game Strategy

Medium · Game Theory & Logic · Quant Trader interview question · game-theory, nim, xor, winning-strategy

You are playing the game of Nim against another trader. There are three piles of coins. The first pile has 5 coins, the second has 7 coins, and the third has 9 coins. You move first. On each turn, a player must choose one pile and remove at least one coin from it. The player who takes the last coin wins. What is the optimal first move to guarantee a win?