Sanju introduces a game called pile of pebbles to Mira. There are two piles of pebbles. Each pile contains 7 pebbles. Each player can pick as many pebbles they want from either of the piles.
Advertisements
Question
Sanju introduces a game called pile of pebbles to Mira.

There are two piles of pebbles. Each pile contains 7 pebbles. Each player can pick as many pebbles they want from either of the piles. The player who picks the last pebble wins.
Try this game with your friends. Now, how do you play so that you win?
To find a winning strategy, try playing with 1 pebble in each pile, two in each, three in each, and so on.
Advertisements
Solution
Play as the second player and mirror the first player’s move.
If the first player removes k pebbles from one pile, remove k pebbles from the other pile. After your move, the two piles are equal again. This keeps the position balanced after your turn, so the first player can never take the last pebble on their move; you take the remaining equal number and win.
Check small cases: with 1 and 1, first takes one, second takes the last. With 2 and 2, if first takes 1, second takes 1 from the other pile, leaving 1 and 1; first then takes one, second takes the last. So for 7 and 7, the winning strategy is to let the opponent start and copy their move in the other pile.
