Quant Brainteasers: 10 Classic Interview Puzzles and the Idea Behind Each
Ten classic quant brainteasers solved, from two eggs and 25 horses to pirates and prisoner hats, with the idea behind each and the variant interviewers use.

Brainteasers have the worst reputation of any part of the quant interview. Candidates think of them as trivia: you have heard the one about the two eggs or you haven't. That isn't how interviewers use them. A brainteaser is a small, closed problem where the answer matters less than whether you can find a structure in it, and the same few structures come up again and again.
This guide works through ten classic quant brainteasers. For each one we give the answer, the idea that cracks it, and a variant an interviewer might use to check that you understood the idea and didn't just remember the number.
The short answer
Quant brainteasers test a handful of reusable ideas: work backwards from the end, find an invariant (parity, a count, a remainder), build from the one thing that is certain, count the information each step gives you, and change your point of view until the problem becomes obvious. Learn the ideas, not the answers. Interviewers know which puzzles are famous, so they change a detail and watch whether your method survives.
To practise, work through the classics below out loud. Then do graded problems from the brain teasers and puzzles collections on PuzzledQuant, where you submit an answer and it is checked, instead of reading the solution and telling yourself you would have got there.
What interviewers are scoring
A brainteaser is usually five or ten minutes inside a longer interview. The interviewer wants to see you look for structure before you calculate (brute-forcing 100 lockers by hand tells them how you would attack a messy real problem), try small cases first, and handle being stuck: say what you tried, why it fails, and take a hint well. As our Jane Street interview guide puts it, the narration is scored, not just the answer.
The five ideas behind most brainteasers
| Idea | What it looks like | Puzzles below |
|---|---|---|
| Work backwards | Solve the last step first, then the step before it | Two eggs, pirates, the 100-coin game |
| Invariants and parity | Something stays fixed (or flips) every move | Lockers, prisoner hats |
| Change the point of view | Relabel the objects so the hard interaction vanishes | Ants on a stick, clock hands |
| Count the information | Each test has k outcomes, so n tests separate at most kⁿ cases | Eight balls, 25 horses |
| Use what you can control | Find the one action whose timing is certain | Burning ropes |
Ten classic quant brainteasers
1. The hundred lockers
A hallway has 100 closed lockers. Person 1 opens every locker. Person 2 toggles every second locker, person 3 every third, and so on up to person 100. How many lockers are open at the end?
Answer: 10. Locker is toggled once for every divisor of . Divisors come in pairs ( and ), so most numbers have an even count and end closed. The exception is a perfect square, where one divisor pairs with itself. The open lockers are 1, 4, 9, …, 100.
Idea: pair things up and look for what doesn't pair. The variant: which lockers were toggled exactly three times? Those with exactly three divisors, which are the squares of primes: 4, 9, 25 and 49.
2. Two eggs and a hundred floors
You have two identical eggs and a 100-floor building. An egg breaks if dropped from floor or higher, for some unknown . What is the fewest drops that guarantees you find ?
Answer: 14. Once the first egg breaks, the second has to check floors one at a time. So if the first egg is dropped from floor first, it must be , since a break there leaves floors to check one by one. Each later drop of the first egg should climb one floor less than the last, so that the worst case stays the same. With drops you can cover floors, and the smallest with is 14. Drop from 14, 27, 39, 50, 60, 69, 77, 84, 90, 95, 99, 100.
Idea: fix the worst case and work backwards. The variant: three eggs? With eggs and drops you can cover floors, and the general answer is a recursion the interviewer will want you to set up rather than recite. For three eggs and 100 floors it is 9 drops.
3. Twenty-five horses
You have 25 horses and a track that races five at a time. You have no stopwatch, only finishing order. How many races do you need to find the three fastest?
Answer: 7. Race five groups of five (5 races). Race the five group winners (race 6). Call the winner A1, and suppose the other winners finish in the order B1, C1, D1, E1. D and E's groups are out, and so is everyone below third in C, second in B, and so on. The only horses that can still be second or third are A2, A3, B1, B2 and C1, which is exactly five. Race them (race 7) and take the top two.
Idea: every race gives you information, so spell out what each result rules out. The variant: how many races to find just the fastest? Six. The top five? Make the candidate list again; it is a good test of whether you can keep the bookkeeping straight.
4. Burning ropes
You have two ropes. Each takes exactly 60 minutes to burn, but they burn unevenly, so half the length doesn't mean half the time. How do you measure 45 minutes?
Answer: light rope A at both ends and rope B at one end. Rope A burns out after exactly 30 minutes, whatever its shape, because the two flames between them cover all of it. At that moment rope B has 30 minutes left; light its other end too, and it burns out 15 minutes later. Total: 45.
Idea: find the one thing that is certain (two flames on one rope halve its remaining time) and build from it. The variant: measure 15 minutes. The last stretch of the solution above already does it: start your clock when rope A burns out and stop it when rope B does. Interviewers like this follow-up because it checks you know which part of your answer did the work.
5. Eight balls and a balance
Eight balls look identical, but one is slightly heavier. With a balance scale, what is the fewest weighings that guarantees you find it?
Answer: 2. Each weighing has three outcomes (left heavy, right heavy, balanced), so two weighings separate at most cases. Weigh 3 against 3. If they balance, the heavy ball is in the other 2, and one more weighing settles it. If not, take the heavy group of 3, weigh 1 against 1, and the result points to the ball either way.
Idea: count outcomes. A three-way test should split the cases into three roughly equal groups, not two. The variant: the famous harder version, twelve coins, one counterfeit that is either heavier or lighter, three weighings, has possibilities against outcomes, so it is possible but tight. Interviewers mostly want the counting argument, then a credible first weighing (4 against 4).
6. The pirates and the gold
Five pirates, ranked A to E, split 100 gold coins. The most senior pirate proposes a split and everyone votes. If at least half vote yes, the split stands. Otherwise the proposer is thrown overboard and the next pirate proposes. Pirates want to survive first, then get as much gold as possible, and, all else being equal, they would rather see someone thrown overboard. What does A propose?
Answer: A takes 98, C and E get 1 each, B and D get nothing. Work backwards. With only D and E, D proposes 100 to 0 and his own vote is half, so it passes. With C, D and E, C needs one more vote; E gets nothing if C dies, so E accepts 1. With B, C, D and E, B needs one more vote; D gets nothing under C's plan, so D accepts 1. With all five, A needs two more votes, and C and E are the ones who get nothing under B's plan, so one coin each buys them.
Idea: backward induction. Solve the smallest game, then use it as the fallback for the next. The variant: what if a proposal needs a strict majority? Redo the induction; the answer changes, and the interviewer wants to see you redo it rather than patch the old one.
7. Prisoners and hats
100 prisoners stand in a line, each wearing a red or blue hat. Each can see every hat in front of them but not their own or those behind. Starting from the back, each prisoner says "red" or "blue", and survives if it matches their hat. Everyone hears every answer. They can agree on a plan in advance. How many can they guarantee to save?
Answer: 99. The prisoner at the back says "red" if they see an odd number of red hats, "blue" if even. That prisoner has a 50% chance. Every prisoner after that knows the parity of the red hats in front of the first speaker, can see the hats ahead of themselves, and has heard every answer behind them, which together pin down their own hat exactly.
Idea: one bit of shared information (a parity) can carry a lot. The variant: three hat colours? Use the sum of the colours mod 3 instead of a parity. The idea is the same.
8. Ants on a stick
100 ants are placed at random points on a one-metre stick, each facing left or right at random. They all walk at one metre per minute. When two ants meet, both turn around. An ant falls off when it reaches an end. What is the longest you might wait until every ant has fallen off?
Answer: one minute. When two ants meet and turn around, it looks exactly like two ants walking straight through each other, if you ignore which ant is which. So the set of positions behaves as if no ant ever turned, and each "ghost" ant walks off within one minute.
Idea: relabel the objects so the interaction disappears. The variant: which ant falls off last? Now labels matter. Ants never pass each other, so their left-to-right order is fixed, and you can work out which ant leaves at which time from the ghost times.
9. Clock hands
How many times a day do the hour and minute hands of a clock overlap?
Answer: 22. The minute hand gains a full lap on the hour hand every hours, about 65 minutes and 27 seconds. In 12 hours that happens 11 times, so 22 times in 24 hours. The tempting answer, 24, counts an overlap near every hour, but between 11 and 1 there is only one, at 12:00.
Idea: switch to relative motion. Watch the minute hand from the hour hand's point of view. The variant: how many times are the hands at right angles? Twice per lap of relative motion, so 44 a day.
10. The hundred-coin game
There are 100 coins on the table. Two players take turns removing between 1 and 10 coins. Whoever takes the last coin wins. Do you want to go first, and what do you do?
Answer: go first and take 1. That leaves 99, a multiple of 11. Whatever your opponent takes (say ), you take , so after each of your turns the pile is again a multiple of 11, and you take the last coin.
Idea: find the losing positions by working backwards from the end. Here they are the multiples of 11. The variant: the player who takes the last coin loses? Now you want to leave your opponent with one more than a multiple of 11. Positions like these are the subject of the game theory and strategy game collections.
How interviewers change the puzzle
A strong interviewer starts with the classic, waits for the answer, then changes one number, one rule or the question itself, as in the variants above. If you only remembered the answer, the variant leaves you with nothing. If you understood it, the variant is a two-minute extension. So it is fine to say "I think I've seen this one" and give the idea; pretending to solve a famous puzzle from scratch goes over badly.
Where brainteasers sit in the loop
Brainteasers show up most in first and second rounds at trading firms and in some research interviews, usually mixed in with probability and expected value questions rather than in a round of their own. Many of the "brainteasers" candidates report are really probability questions in disguise, so if you are short on time, our guide to probability interview questions is the better investment. For how brainteasers fit into the rest of the interview, from the online assessment to the superday, start with our complete guide to preparing for quant interviews.
How to practise
Start with the classics in print. Chapter 2 of Xinfeng Zhou's A Practical Guide to Quantitative Finance Interviews (the green book) is a chapter of brainteasers, and several of the puzzles above appear there in some form. It is the standard reference for a reason. The catch is that the classics are so widely known that interviewers have moved on to variants, so treat the book as a source of ideas. Our review of the best quant interview books covers what else is worth reading.
Use Brainstellar for a free daily puzzle. Brainstellar is a free collection of classic puzzles sorted into easy, medium, hard, probability and strategy sets. The answers are brief and nothing is graded, so it works best as a warm-up, not as your main practice.
Do graded problems. On PuzzledQuant, the brain teasers and puzzles collections take a submitted answer and check it, with a hint and a written solution. The question of the day is a good habit to build on top. A large part of both collections is free; the rest comes with Premium.
Practise out loud, with a timer. Give yourself ten minutes a puzzle, and talk the whole time. If you get stuck, write down what you would say to the interviewer to ask for a hint. That sentence is worth rehearsing.
Frequently asked questions
What kind of brainteasers do quant firms ask?
Short logic and counting puzzles with a clean answer: the two-egg problem, the 25 horses, burning ropes, the pirates splitting gold, prisoner hats, and coin-taking games. Most rely on a few ideas, namely working backwards, invariants and parity, counting information, and changing your point of view. Interviewers often change a detail of a famous puzzle to see whether you understand the idea.
Should I say if I have heard a brainteaser before?
Yes. Interviewers know which puzzles are famous. Say you think you have seen it, explain the idea behind the answer, and expect a variant. Pretending to solve a familiar puzzle from scratch is easy to spot and costs you more than admitting you know it.
How many brainteasers should I practise before a quant interview?
Fewer than you think, as long as you understand them. Thirty or forty puzzles that cover the main ideas, each solved out loud and then extended with a variant of your own, prepare you better than two hundred read quickly. Graded practice helps, because it stops you giving yourself credit for answers you would not have reached.
What is the best book for quant brainteasers?
The green book, Xinfeng Zhou's A Practical Guide to Quantitative Finance Interviews, has a full chapter of classic brainteasers with solutions. Pair it with a free daily puzzle from Brainstellar and graded practice on PuzzledQuant's brain teasers and puzzles collections.