Qm
BrainteasersJane StreetCitadel

Nim where the last stone loses

Three piles hold 3, 4 and 5 stones. On a turn a player removes any positive number of stones from one pile. In ordinary Nim the player who takes the last stone wins. In this misère version, the player who takes the last stone loses.

Who wins from 3, 4, 5 with best play, and what is the winning first move? How does the misère strategy differ from the ordinary one?

Show a hint

The ordinary Nim strategy is to move to a position whose pile sizes have binary exclusive-or equal to zero. That strategy still works in misère Nim until all the remaining piles have size 1, at which point you want to leave an odd number of them.

Your answer

Solving needs a free account

Answers, streaks and solutions unlock when you are signed in. Reading the question and the hint stays free.

Discussion

Sign in to join the discussion · reading is open to everyone

💡 Discussion rules

  1. No full solutions here. Hints and approaches only.
  2. Complexity, edge cases and intuition are the point.
  3. Interview experiences are welcome. Respect your NDAs.

Loading discussion…

Learn the concepts

The theory behind this question.

Related questions

Take one, two or four stonesTake one, three or fourTwenty coins in a circleGuess each other's coinPlacing knights so that none attackTwo piles, take from one or equally from both
All questions →