#427

Three Drawers of Chips

Also asked as: The game of Nim · the three heaps game · nim strategy with XOR

One of the classic quant interview questions, free to read in full.

Problem

Three desk drawers hold 5, 8, and 12 poker chips. Two players alternate turns; a turn means choosing one drawer and removing any positive number of chips from it. Whoever takes the last chip in the room wins. You move first. Find every winning first move, and the principle that generates them.

Your answer

This one is graded like the real thing: reason it through out loud (structure, key insight, numbers), then reveal and self-grade.

Hints

More Brainteasers & Logic to train on

All Brainteasers & Logic questions →