Puzzles

Reasoning puzzles of the kind interviews ask, each with a worked solution that explains how to get there rather than only what the answer is.

A puzzle in an interview is rarely about the answer. What is being watched is how you start on something you have not seen before: whether you ask what the constraints are, whether you try a smaller version first, and whether you say what you are thinking. Silence followed by a correct answer scores worse than thinking aloud and getting most of the way.

So every puzzle here shows its working, and says which technique it is really about. That last part is the one worth keeping — parity, counting outcomes, balancing a worst case, finding an invariant. The answers you can look up; the techniques are what let you solve the one you were actually asked.

Measuring and weighing

A scale, a jug or a balance, and fewer uses of it than feels possible. Each one turns on how much information a single measurement can carry, which is usually more than people assume.

Puzzle What it tests Difficulty
Eight Balls, One Heavier A balance, eight identical balls and only two weighings. Three outcomes from one weighing Easy
Ten Jars, One of Them Light Ten jars, one filled with underweight pills, and a scale you may use once. Encoding identity in quantity Medium
Three Litres, Five Litres, Four Wanted Two unmarked jugs and a tap. Measure exactly four litres. Reachable amounts and the greatest common divisor Easy
One Poisoned Barrel One of a thousand barrels is poisoned. Ten testers, one round. Find it. Reading each tester as one binary digit Hard
Twelve Balls, One Odd One of twelve balls differs in weight. Three weighings, and say which way. Making every weighing three-way informative Hard
Three Coins, One Light One of three coins is light. Find it with a single use of the balance. Reading a balance's third outcome Easy
Nine Coins, Two Weighings One coin among nine is light. Two weighings are enough - if you divide correctly. Splitting into three, not two Easy
Twenty-Seven Balls One of 27 balls is heavy. Three weighings find it, and 28 would not. Seeing the pattern scale Medium
The Weight That Broke in Four A 40 kg weight shatters into four pieces that can still weigh every whole load to 40. Using both pans to get negative amounts Medium
Two Bad Batches Ten crates, two of them underweight, and one reading on a digital scale. Encoding a subset in a single number Hard
The Balance With Unequal Arms A balance has unequal arms. Two weighings still give the honest weight. Cancelling a systematic error Medium
The Best and the Second Best Eight stones, a balance, and the two heaviest to be found in nine weighings. Reusing information from a knockout Hard
Both Ends at Once Ten parcels, and both the heaviest and lightest wanted in thirteen weighings. Pairing before comparing Hard
Thirteen Coins and a Spare Twelve coins take three weighings. A thirteenth is possible - with one honest coin to spare. Why an extra reference coin buys a case Hard
One Light Coin in Eighty-One Eighty-one coins, one of them light, and four weighings exactly. Scaling a three-way search Medium
Six Kilos From Twenty-Four Twenty-four kilos of flour, a balance, no weights, and 6 kg wanted in two weighings. Using a balance to divide rather than to measure Easy
Eight Litres, Shared Evenly Jugs of 8, 5 and 3 litres, no markings, and two equal shares wanted. Searching a small state space by hand Medium
Four Weights, One Pan Weights may go in one pan only. Which four cover every load to fifteen? Choosing a base to match the rules Medium
Sorting Five With Seven Weighings Five stones of different weights, into order, with seven comparisons. Bounding a problem by counting outcomes Hard
Twenty-Four Balls, One Odd One ball differs but you do not know whether it is heavy or light. Applying the outcome bound to a two-sided defect Hard
Twelve Coins, Or Perhaps None One of twelve coins may be false. Or they may all be genuine. Counting the do-nothing case as a case Hard
The Lost Weight The set was 1, 3, 9, 27. The 9 is lost. What can still be weighed? Enumerating reachable values Medium
The Heaviest of Eight Eight stones, one balance, and the heaviest found in seven comparisons. Counting eliminations rather than weighings Easy
Four Balls and a Known-Good One Four suspects, two weighings, and a direction you do not know. Using a reference to balance the pans Medium
Two Heavy Coins Among Eight Two of eight coins are heavy, and equally so. Find both. Searching for a pair rather than a single Hard

Arrangement puzzles

Things in a line, in piles or in a sequence of passes. The answer is almost always an invariant: something that does not change however the arrangement is shuffled, which you can therefore reason about without tracking the shuffling.

Puzzle What it tests Difficulty
A Hundred Doors, A Hundred Passes Toggle every door, then every second, then every third. Which are open at the end? Counting divisors, and when the count is odd Medium
Ten Coins in the Dark Five of ten coins are heads up. Split them into two piles with equal heads, blindfolded. Creating an invariant you cannot observe Medium
Paying With a Gold Rod Seven days of wages from one rod, and you may cut it twice. Making change with powers of two Medium
Sixty-Six Handshakes Everybody shakes everybody’s hand once, making 66 handshakes. How many people? Counting pairs and inverting the count Easy
Socks in the Dark A drawer of black and blue socks, no light. How many to be sure of a pair? Reasoning about the worst case, not the likely one Easy
The Seventeen Camels Divide 17 camels into a half, a third and a ninth without cutting any. Noticing the shares do not add to one Medium
Ants on a Pole Ants walk along a metre pole and reverse when they meet. How long until all fall off? Seeing that a collision is a relabelling Hard
Round the Table In how many ways can six people sit round a circular table? Dividing out the rotations Medium
The Letters of a Word How many distinct arrangements are there of the letters of BANANA? Dividing out identical items Medium
Sharing a Birth Month How many people must be in a room before two certainly share a birth month? Guaranteeing rather than expecting Easy
Eight Queens on a Board Place eight queens so none attacks another. There are 92 ways. Searching with constraints instead of by hand Hard
The Three by Three Magic Square The rows must add to 15 and the middle must be 5. After that there is only one square. Deducing the centre before placing anything Medium
Rearranging MISSISSIPPI Eleven letters, but four S, four I and two P. Not 11 factorial. Dividing out the repetitions Medium
Everyone Plays Everyone Ten teams, each playing all the others once. Forty-five matches. Counting pairs without double counting Easy
The Fifteen Puzzle Sliding tiles can reach half the arrangements. Swapping two is not one of them. Finding a quantity that no legal move can change Hard
Two Londoners With the Same Number of Hairs Nine million people, two hundred thousand possible hair counts. Forty-five must match. Proving existence without finding an example Medium
Alternating Round a Table Four boys and four girls round a table, no two of the same sitting together. Counting circular arrangements without double counting rotations Hard
An Even Number of Odd People However people pair off, the number who shook an odd number of hands is even. Counting one thing from two directions Medium
Six People at a Party Among any six people, three all know each other or three are all strangers. Forcing a structure out of pure size Hard
Eight Rooks, No Captures Eight rooks on a chessboard, none attacking another. Forty thousand ways. Recognising an arrangement as a permutation Easy
The Number That Describes Itself Ten digits, where the first says how many zeros there are, and so on. Solving a constraint that refers to its own answer Medium
Beads on a Necklace Six beads in a ring. A necklace can be turned, and it can be turned over. Deciding which arrangements count as the same Medium
A Committee and Its Chair Choose a committee of any size from five people, then pick its chair. Counting the same set two ways to prove an identity Medium
Across the Grid Four blocks east, four blocks north, always moving towards the corner. Turning a route into a sequence of choices Medium
The Knight's Tour A knight visiting all 64 squares once. Possible — but not on every board. Colouring argument against a counting one Hard

Questions people ask

Why do interviews ask puzzles?

Less often than they used to, and rarely to see whether you get the answer. What an interviewer is watching is how you start on something you have not seen before: whether you ask what the constraints are, whether you try a smaller version first, and whether you say what you are thinking. Silence followed by a correct answer scores worse than thinking aloud and getting most of the way.

Is it worth memorising the classic ones?

Only up to a point. The classics are worth knowing because the technique in each one - pigeonhole, invariants, working backwards from the end state, weighing to split a set in three - transfers to puzzles you have not seen. Memorising the answer without the technique leaves you with nothing the moment the numbers change.

What if I cannot solve one?

Read the working, then close it and solve it again from scratch a day later. A puzzle you have read the answer to is not a puzzle you can do.