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.

River crossing puzzles

A boat, a bridge or a torch, and a rule about who may be left with whom. Every one is a search through states, and the trick is nearly always a move that looks like going backwards.

Puzzle What it tests Difficulty
The Wolf, the Goat and the Cabbage Get all three across a river in a boat that holds one, without losing any. Being willing to carry something back Easy
The Torch and the Bridge Four people, one torch, a bridge that holds two. Cross in seventeen minutes. Sending the two slowest together Hard
Three Couples and a Boat Three couples, a two-person boat, and no wife left with another husband. Searching states instead of guessing moves Hard
The Soldiers and the Boys A boat that carries two boys or one soldier. Get the whole army across. Finding the repeatable unit of progress Medium
Three and Three, Boat for Two Six must cross in a two-seat boat, and neither bank may ever go wrong. Searching a space where the obvious move loses Hard
The Same Six, a Bigger Boat One extra seat turns an eleven-crossing ordeal into five. Seeing how a constraint change collapses a problem Medium
A Hundred Kilos of Boat A man of 100 kg and two sons of 50 kg each, and a boat that will carry 100 kg. Working within a capacity rather than a headcount Medium
Five People, One Torch Walkers of 1, 2, 5, 10 and 15 minutes, a two-person bridge and one torch. Pairing the slow walkers instead of escorting them Medium
Frogs and Toads Change Places Three frogs and three toads on seven stones must pass each other. Counting slides and jumps separately Hard
Ten Stepping Stones Hop one stone or two at a time across ten. How many different crossings? Recognising a recurrence in a crossing Medium
How Far Into the Desert? A jeep with three tanks of fuel and permission to cache some of it in the sand. Placing depots so every litre is spent efficiently Hard
Two Short Planks A square moat, an island in the middle, and two planks both too short. Crossing a corner instead of a side Medium
One Bicycle, Two Travellers Twenty kilometres, one bicycle between two, and both must arrive as soon as possible. Minimising the later of two arrivals Medium
Straight Across a Current A 5 km/h boat, a 3 km/h current, and a landing point directly opposite. Splitting a speed into components Medium
Two Ferries, Two Meetings They meet once going out and once coming back. How wide is the river? Counting total distance instead of speeds Hard
The Hat and the Bridge A rower loses his hat under a bridge and notices five minutes later. Choosing the frame of reference Medium
The Man in the Tunnel He escapes by running back, and he escapes by running on. How fast is the train? Extracting a ratio from two tied races Hard
Twelve People, a Boat for Four Four at a time across, one rows back. How few crossings? Counting net transfer per round trip Medium
The Raft With a Weight Limit Four people, a raft that holds 180 kg, and one forbidden pairing. Finding the one pair that cannot travel together Medium
Two Jeeps, One Crossing One jeep carries the other's fuel part of the way, then comes home. Choosing where a support vehicle should turn back Hard
Swimming Against a Stronger Current The current is twice his speed. He cannot land opposite — so how little can he lose? Optimising when the direct route is impossible Hard
Four Across in Twelve Minutes Walkers of 1, 2, 4 and 5 minutes, one torch, and a bridge that holds two. Choosing between escorting and pairing Medium
Two Trains, One Track Two trains meet head on. The only siding holds one engine. Using a dead end as temporary storage Medium
Round the Corner With a Ladder Two corridors meeting at a right angle. How long a ladder can turn the corner? Finding the tightest position, not the easiest Hard
One of Them Cannot Row Four people, a two-seat canoe, and one who cannot paddle at all. Checking a constraint does not change the count Easy

Game strategy puzzles

Two players, perfect play, and a question about who wins. These are won by working backwards from the end position rather than forwards from the start, which is a habit worth more than any one answer here.

Puzzle What it tests Difficulty
The Last Stick Twenty-one sticks, take one to three per turn. Who wins, and how? Working backwards from the losing positions Medium
Counting to a Hundred Players add 1 to 10 to a running total. Whoever says 100 wins. Finding the ladder of safe totals Medium
Five Pirates and a Hundred Coins Five ranked pirates divide 100 coins by vote, with death for a rejected plan. Solving the smallest case and building up Hard
Two Piles of Stones Two piles, take any number from one pile. Who wins? Finding the position you want to hand over Medium
Coins in a Row An even row of coins, take from either end. Can the first player guarantee half? Choosing which half of the row you own Medium
Breaking the Chocolate Bar How many snaps to reduce a chocolate bar to its individual squares? Counting pieces rather than moves Easy
Pennies on a Round Table Players place coins on a table until no room is left. Who wins? Owning the centre and copying everything else Medium
Twenty Questions How many yes-or-no questions to find a number between 1 and a million? Halving the candidates every question Easy
The Last Match Loses Twenty matches, take one to three, and whoever takes the last one loses. Re-deriving a strategy when the goal flips Medium
Splitting the Pile Split piles until none can be split. Who makes the last move? Finding the move count that never varies Medium
Hiring the Best Candidate Interview one at a time, decide on the spot, no going back. Reject the first 37%. Trading information against opportunity Hard
Nim With Three Piles Piles of 3, 5 and 7. The first player wins - by adding the piles in binary. Finding the invariant a winning move restores Hard
The Three-Way Duel Three shooters of different skill. The worst one should deliberately fire into the air. Seeing that a successful shot can be a mistake Hard
A Hundred Prisoners and a Hundred Boxes Each may open half the boxes. Random guessing gives nil. One idea gives 31%. Correlating individual chances deliberately Hard
Cutting a Cake Three Ways Two people cut and choose. Three is harder, and needs a trimming step. Designing a procedure nobody can exploit Medium
The Poisoned Corner The first player wins at Chomp. Nobody can tell you how. Proving a winner without finding the winning move Hard
Both Better Off, Both Confess Staying silent is better for both. Confessing is better for each. Seeing that individual logic can beat collective sense Medium
Guess Two Thirds of the Average Everyone picks 0 to 100. Closest to two thirds of the average wins. Reasoning about how far others will reason Hard
Bidding for a Pound A pound is auctioned. The loser pays their bid too. It sells for more than a pound. Spotting when the next move is always worth making Medium
Take It or Leave It Offer a split of £100. Refuse, and you both get nothing. What is fair? Noticing where theory and behaviour part company Medium
Three Colours of Hat A line of prisoners, hats in three colours, and all but one guaranteed to survive. Sacrificing one player to inform everybody else Hard
Two Piles, Two Kinds of Move Take from one pile, or equally from both. The losing positions involve the golden ratio. Finding losing positions that follow an irrational pattern Hard
Twenty Questions, One Lie Find a number from 1 to 1,000,000 when one answer may be false. Paying for error correction in questions Hard
The Two Generals They must attack together. Every messenger may be captured. No protocol works. Showing that no finite exchange can create certainty Medium
One More Cow on the Common Each extra animal profits its owner and costs everyone. The pasture dies. Comparing private gain with shared cost Medium

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.