QA interview puzzles: the 20 that actually get asked
Puzzle rounds don't score the answer — they score how you reason toward one, out loud, under mild pressure. Memorising answers without the reasoning is visibly hollow to any interviewer.
Here's what the interviewer is actually doing during a puzzle: watching whether you clarify the rules, whether you try a small case before the big one, whether you say your partial reasoning or go silent, and how you react when your first idea dies. The answer is almost a formality — several of these are pass-able while getting the final number wrong, if the reasoning was honest.
How to use this page: the collapsed cards show what each puzzle tests and a hint — not the answer. Genuinely try each one from the hint first; the reasoning you build yourself is the thing that transfers to the variant they'll actually ask.
The method: four moves for any puzzle
- Restate and clarify. "Just to confirm — the burn rate is uneven, only the total is fixed?" Half of all puzzles hide the unlock in a rule people skim. Asking is scored, not penalised.
- Shrink it. Can't see 100 doors? Do 10. Can't see 5 pirates? Do 2. Small cases expose the structure that the big number hides.
- Say the dead ends. "Halving gives me three weighings — too many, so the balance must give more than two outcomes…" A visible wrong path followed by a correction is worth more than silence followed by a right answer.
- Check before declaring. Walk your answer through the original constraints once, aloud. Testers who self-verify are hired for exactly that reflex.
These are the same muscles as scenario questions — structured thinking under incomplete information — and the same reflex the take-home round scores as "judgment". Puzzle rounds are just the purest, crunchiest version.
Deduction and lateral thinking
Three switches, three bulbs. You can flip switches freely but enter the bulb room only once. Which switch controls which bulb?
Tests: Using more than one observable — the tester instinct · Hint: Bulbs give off more than light.
Three switches outside a closed room control three bulbs inside. Flip whatever you like, but you may open the door only once. Map every switch to its bulb.
How to think it through — out loudThe trap is treating on/off as the only signal — two states can't distinguish three bulbs in one visit. So find a second observable. A bulb that has been on recently is warm. Turn switch 1 on for ten minutes, then off. Turn switch 2 on. Enter: the lit bulb is switch 2, the dark-but-warm bulb is switch 1, the dark-and-cold bulb is switch 3.
The answerHeat is the second signal: lit = switch 2, warm-off = switch 1, cold-off = switch 3.
The trapAnswering 'impossible with one visit' — the interviewer is checking whether you look for extra observables before declaring a dead end.
Three jars are labelled Apples, Oranges and Mixed — and every label is wrong. Pick one fruit from one jar to fix all three labels.
Tests: Squeezing maximum information from one test case · Hint: One jar's wrong label tells you more than the others.
Three sealed jars: apples only, oranges only, and a mix. All three labels are wrong. You may draw a single fruit from a single jar, then relabel everything correctly.
How to think it through — out loudPick from the jar labelled Mixed — since its label is wrong, it's pure. Draw an apple? That jar is Apples. Now the jar labelled Oranges can't be oranges (label wrong) and can't be apples (taken) — it's Mixed. The last jar is Oranges. One draw, three labels, because you chose the jar whose wrong label guaranteed a pure result.
The answerDraw from 'Mixed' — it's pure. That fruit names the jar; the other two rotate by elimination.
The trapDrawing from Apples or Oranges first — a mixed jar could give you either fruit, and one draw tells you nothing certain.
Two doors: one to success, one to rejection. Two guards: one always lies, one always tells the truth. One question to one guard — which door do you take?
Tests: Designing a question whose answer is reliable through an unreliable channel · Hint: Route your question through BOTH guards.
You don't know which guard is which. You may ask exactly one question to exactly one of them, then must choose a door.
How to think it through — out loudAny direct question ('is this the good door?') gives an answer you can't calibrate — you don't know who you asked. So build a question that passes through both minds: 'If I asked the other guard which door is safe, what would they say?' Truth-teller honestly reports the liar's lie. Liar lies about the truth-teller's truth. Both name the wrong door — so take the opposite.
The answerAsk either guard what the OTHER would say, then take the opposite door. Both answers point wrong by construction.
The trapSpending the question identifying who lies — you get the identity and no door, and the question is gone.
100 closed doors. Pass 1 toggles every door, pass 2 every 2nd, pass 3 every 3rd… up to pass 100. Which doors end open?
Tests: Finding the structure instead of simulating 100 passes · Hint: A door's fate is the count of its divisors.
All doors start closed. On pass k you toggle every k-th door. After 100 passes, which doors are open?
How to think it through — out loudDoor n gets toggled once per divisor of n — door 12 by passes 1, 2, 3, 4, 6, 12. Divisors pair up (2 with 6, 3 with 4), so most doors get an even number of toggles and end closed. The exception: perfect squares, where one divisor pairs with itself (6×6 for 36) — odd toggles, door ends open.
The answerDoors 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 — the perfect squares. Ten doors.
The trapStarting to simulate pass by pass on the whiteboard — the interviewer wants the divisor insight, and simulation runs out of board.
Weighing and measuring
Two identical eggs, a 100-floor building. Find the highest floor an egg survives — with the fewest drops in the worst case.
Tests: Worst-case thinking — pure test-design instinct · Hint: Make every outcome cost the same total drops.
An egg that survives a drop is reusable. Once both eggs break, you must already know the answer. Minimise the worst-case number of drops.
How to think it through — out loudOne egg alone forces floor-by-floor. Two eggs: use the first to bracket in jumps, the second to walk the bracket. Equal jumps of 10 give worst case 19. The refinement: after each first-egg drop you've spent one attempt, so make each next jump one floor smaller — then every path costs the same. Start at floor n where n + (n−1) + … + 1 ≥ 100 → n = 14. Drop at 14, 27, 39, 50, 60, 69, 77, 84, 90, 95, 99, 100.
The answer14 drops worst case — first egg at floor 14, then jumps shrinking by one each time.
The trapStopping at the √100 = 10-jump answer (worst case 19) — the shrinking-step idea is the senior half of the puzzle.
8 identical-looking balls, one slightly heavier. A balance scale, two weighings. Find the heavy one.
Tests: Designing tests that split the search space three ways, not two · Hint: A balance has three outcomes, not two.
Seven balls weigh the same; one is heavier. Using a two-pan balance exactly twice, identify the heavy ball.
How to think it through — out loudThe instinct is halving: 4v4, then 2v2, then 1v1 — three weighings. But a balance gives three outcomes: left, right, balanced. Use all three. Weigh 3 v 3, leaving 2 aside. Balanced → heavy is in the pair; weigh them. Tilted → take the heavy trio, weigh 1 v 1: tilt names it, balance means the third.
The answerTwo weighings: 3v3 first, then 1v1 inside the guilty group. Ternary search, not binary.
The trap4v4 first — it wastes the balanced outcome (impossible with 8 split evenly) and forces a third weighing.
Two ropes, each burns end-to-end in exactly 60 minutes — but unevenly. Measure exactly 45 minutes.
Tests: Working with unreliable instruments — very QA · Hint: Both ends of a rope is 30 minutes, whatever the unevenness.
Burn rate varies wildly along each rope; only the total (60 min) is guaranteed. Using fire alone, mark a 45-minute interval.
How to think it through — out loudYou can't use length — the burn is uneven. But lighting a rope at both ends burns it in exactly 30 minutes regardless of unevenness: the flames must meet when the remaining time is spent from both sides. So: light rope A at both ends AND rope B at one end. A finishes at minute 30; at that instant B has 30 minutes left — light B's other end, halving that to 15. B dies at minute 45.
The answerA both ends + B one end; when A dies (30 min), light B's other end — B dies at 45.
The trapAny answer using 'half the length' — the uneven burn is stated precisely to kill that path.
A 3-litre jug, a 5-litre jug, unlimited water. Measure exactly 4 litres.
Tests: State-space thinking on a tiny system · Hint: 4 = 5 − 1, and 1 is makeable.
No markings on either jug. Fill, empty and pour between them to end with exactly 4 litres in the 5-litre jug.
How to think it through — out loudTrack states as (small, large). Fill the 5 → (0,5). Pour into the 3 → (3,2). Empty the 3 → (0,2). Pour across → (2,0). Fill the 5 → (2,5). Top up the 3 — it takes exactly 1 → (3,4). The move that matters is creating the 1-litre remainder by topping up a partly-full jug.
The answerFill 5, pour to 3, empty 3, transfer the 2, refill 5, top up 3 — the 5-jug holds 4.
The trapNarrating pours without tracking state — say the (x, y) numbers aloud; losing count mid-answer is the common fail.
Optimisation and planning
25 horses, 5 lanes, no stopwatch. Minimum races to find the fastest 3?
Tests: Eliminating candidates by reasoning, not by re-testing everything · Hint: After the semifinals, most horses are provably out.
Only 5 horses race at a time; you learn order, not times. Find the top 3 overall in the fewest races.
How to think it through — out loudFive group races seed everything (5). Race the five group-winners (6): the winner is #1 overall. Who can still be #2 or #3? Only: the 2nd and 3rd from race six, the runner-up and third from the champion's group, and the runner-up from the second-place winner's group — five horses. Everyone else has three provably-faster horses above them. Race those five (7): its top two are #2 and #3.
The answer7 races: five heats, the winners' final, then a five-horse decider for places 2–3.
The trapAnswering 6 by forgetting that the #2 group's runner-up can outrank the #3 group's winner — walk the elimination logic aloud.
Four people cross a bridge at night with one torch; times 1, 2, 7, 10 minutes; two cross at a time at the slower one's pace. Get all across in 17 minutes.
Tests: Spotting that the greedy strategy isn't optimal · Hint: Send the two slowest together — once.
The torch must accompany every crossing, so someone always walks it back. Pairs move at the slower member's speed. Beat 19 minutes — hit 17.
How to think it through — out loudGreedy uses the 1-minute person as a shuttle for everyone: 10+1+7+1+2 = 21… optimised, 19. The insight: 7 and 10 should cross together, so the 7 hides inside the 10. But then someone fast must already be on the far side to bring the torch back. So: 1+2 cross (2), 1 returns (3), 7+10 cross (13), 2 returns (15), 1+2 cross (17).
The answer1&2 over, 1 back, 7&10 over, 2 back, 1&2 over — 2+1+10+2+2 = 17 minutes.
The trapEscorting everyone with the fastest walker — pairing the slow pair is the whole puzzle, and 19 is the wrong-but-confident answer.
Pay a worker one gold-bar segment per day for 7 days — but you may make only 2 cuts in the bar.
Tests: Recognising that change can flow backwards · Hint: Payments can be exchanges, not just gifts.
A bar of 7 equal units, cuts at any positions, two cuts total. The worker must hold exactly n units at the end of day n.
How to think it through — out loudTwo cuts give three pieces — make them 1, 2 and 4. Day 1: give 1. Day 2: give 2, take back 1. Day 3: give 1 (holds 1+2). Day 4: give 4, take back 1 and 2. Days 5–7 repeat the pattern. Pieces 1-2-4 are binary weights: every value 1–7 is a sum of them, so every day's total is payable if change is allowed.
The answerCut into 1, 2 and 4 units; pay with exchanges. Binary representation does the rest.
The trapAssuming pieces once given are gone — the unlock is asking 'can I take change back?', a requirements question. Ask it aloud.
A camel must move 3,000 bananas across 1,000 km. It carries 1,000 max and eats 1 banana per km walked. Maximum bananas delivered?
Tests: Multi-stage cost optimisation — accepting losses early to save later · Hint: Fewer bananas means fewer trips means cheaper kilometres.
Every kilometre walked — loaded, empty, forwards or back — costs one banana eaten. Bananas can be cached anywhere. Maximise what reaches the far side.
How to think it through — out loudWith 3,000 bananas the camel shuttles: moving the pile 1 km takes 5 legs (3 forward, 2 back) = 5 bananas/km. That rate holds until the pile drops to 2,000 — after 200 km. Then 3 legs = 3 bananas/km until the pile hits 1,000 — another 333⅓ km. From there it's one straight walk: 1,000 − 200 − 333⅓ = 466⅔ km remaining, eating 466⅔ bananas.
The answer1,000 − 466⅔ = 533 bananas delivered (533⅓, rounded down to whole bananas).
The trapWalking straight with the first 1,000 — delivering zero. The phased shuttle IS the answer; narrate the 5-per-km → 3-per-km → 1-per-km stages.
Probability and counting
Monty Hall: 3 doors, one prize. You pick one; the host, who knows, opens a different door showing nothing. Switch or stay?
Tests: Updating on new information — and defending an unintuitive result calmly · Hint: Your first pick was wrong 2/3 of the time. That fact never changed.
The host always opens a no-prize door you didn't pick, then offers a switch. Does switching help?
How to think it through — out loudYour original door was right with probability 1/3 — nothing the host does changes that. The remaining 2/3 sat on the other two doors; the host, constrained to open an empty one, compresses that entire 2/3 onto the one unopened door. Sanity-check with 100 doors: you pick one, the host opens 98 empties — staying feels obviously wrong there. Same logic, three doors.
The answerSwitch. Staying wins 1/3; switching wins 2/3.
The trap'50-50 now' — the doors aren't symmetric, because the host's choice was constrained by where the prize is. The 100-door version is your out-loud defence.
100 passengers board in order; passenger 1 lost his ticket and sits randomly. Everyone else takes their own seat if free, else a random one. Probability passenger 100 gets their own seat?
Tests: Cutting a scary process down to its only two absorbing states · Hint: Only two seats ever matter.
Each displaced passenger picks uniformly among free seats. What's the chance the last passenger finds seat 100 free?
How to think it through — out loudFollow the chaos and it resolves to one observation: the process ends the moment anyone picks seat 1 (everyone after sits correctly — passenger 100 wins) or seat 100 (passenger 100 loses). Every random chooser faces those two seats symmetrically — no one prefers one over the other. All other choices just postpone the same coin flip.
The answer1/2. The whole cascade is one fair choice between seat 1 and seat 100 in disguise.
The trapTrying to sum over 100 cases — the symmetry argument is three sentences; the summation is a whiteboard funeral.
How many times do a clock's hour and minute hands overlap in 12 hours?
Tests: Relative speed over enumeration · Hint: It's not 12 — one overlap goes missing.
Starting at 12:00, count the moments the two hands point the same way over the next 12 hours.
How to think it through — out loudThe minute hand laps the hour hand; each lap is one overlap. In 12 hours the minute hand makes 12 revolutions, the hour hand 1 — so 11 laps, 11 overlaps. That's why there's no overlap 'around 11:55': the 11-o'clock-hour one IS the 12:00 one. They're evenly spaced: every 12/11 hours ≈ 65 minutes 27 seconds.
The answer11 times in 12 hours (22 per day), once every 65 5/11 minutes.
The trapAnswering 12 by assuming one per hour — say the relative-speed argument and name the missing 11-hour overlap.
1,000 wine bottles, exactly one poisoned. Poison shows effects after 24 hours; you have 10 testers and one day. Find the bottle.
Tests: Encoding — one test round carrying maximum information · Hint: Ten yes/no results = ten bits.
Any tester can sip from any number of bottles now; in 24 hours each is either sick or fine. Identify the poisoned bottle among 1,000 with one round.
How to think it through — out loudTen testers produce a 10-bit result — 1,024 distinct outcomes, enough for 1,000 bottles. Number the bottles 0–999 in binary. Tester k sips every bottle whose k-th bit is 1. After 24 hours, write sick=1, fine=0 in position order: the resulting binary number IS the poisoned bottle's label.
The answerBinary-label the bottles; each tester covers one bit position. The sickness pattern spells the bottle number. 10 testers handle up to 1,024 bottles.
The trapSplitting 1,000 by 10 into groups of 100 — that finds the group, not the bottle. Parallel bits, not sequential groups.
Strategy and game logic
Blindfolded, 100 coins on a table, exactly 10 are heads-up. Split them into two piles with an equal number of heads.
Tests: Inventing an invariant instead of seeking forbidden information · Hint: You're allowed to flip coins.
You can't see or feel which side is up, but you may move and flip coins freely. Produce two piles with equally many heads.
How to think it through — out loudYou can't find the heads — so engineer equality instead. Take any 10 coins as pile B and flip every one of them. If k of the original 10 heads landed in pile B, then pile A has 10−k heads — and pile B, after flipping, turned its 10−k tails into heads: also 10−k. Equal, for every k, with zero information needed.
The answerAny 10 coins into a pile, flip that whole pile. Both piles now hold 10−k heads each.
The trapReasoning toward 'impossible without seeing' — the flip is a move that creates the symmetry you couldn't observe.
100 prisoners in a line, each wearing a red or black hat, seeing only the hats ahead. From the back, each says one word — red or black. Best strategy?
Tests: Teams communicating through the answer channel itself · Hint: The first speaker sacrifices himself to send one bit.
Guessing your own hat colour right = freed. They may agree a strategy beforehand. Maximise guaranteed survivors.
How to think it through — out loudThe rearmost prisoner sees 99 hats and encodes one fact everyone can use: he says 'red' if he sees an odd number of red hats, 'black' if even — a parity bit; his own fate is a coin flip. Prisoner 99 counts reds ahead: if the parity he sees differs from the announced one, his own hat is red. Each subsequent prisoner tracks every 'red' spoken behind them and the count they see, and deduces their own hat exactly.
The answerParity strategy: 99 guaranteed correct, the first speaker 50/50 — 99.5 expected.
The trapStrategies where each helps only their neighbour (~50 saved) — one shared parity bit serves all 99, and that leap is what's tested.
5 pirates, 100 gold coins. The senior-most proposes a split; all vote; majority (proposer's tie counts) or he's thrown overboard. All are perfectly rational and greedy. What does he propose?
Tests: Backward induction — solving from the end state · Hint: Start with two pirates left and work up.
Priorities: survive, then maximise gold, then prefer others overboard. Pirates A (senior) to E vote on A's proposal first. What split survives?
How to think it through — out loudWork backwards. Two left (D,E): D proposes 100-0 and wins on his tie-break — E gets nothing there. Three (C,D,E): C needs one vote — buys E with 1 coin (E's alternative is 0): 99-0-1. Four (B..E): B buys D (who'd get 0 under C) with 1: 99-0-1-0. Five: A needs two votes — buys C and E, who each get 0 in B's world, with 1 coin apiece.
The answerA proposes 98–0–1–0–1 (A, B, C, D, E) — and it passes with A, C and E voting yes.
The trapSplitting 'fairly' at 20 each — rationality plus the voting rule makes near-total greed stable; the backward walk is the answer they're grading.
A farmer must ferry a wolf, a goat and a cabbage across a river — one at a time. Unattended, wolf eats goat, goat eats cabbage. Sequence?
Tests: Spotting that a solution may require moving something backwards · Hint: Something has to make a return trip.
The boat holds the farmer plus one passenger. Neither predator-prey pair may be left alone on either bank. Get all three across.
How to think it through — out loudThe goat is the shared threat — it can't be left with either other item. So the goat moves first, and the unlock most people miss: the goat comes back. Take goat over. Return empty. Take wolf over, bring goat back. Take cabbage over (wolf+cabbage coexist happily). Return empty. Take goat over again.
The answerGoat over → back empty → wolf over, goat back → cabbage over → back empty → goat over. Seven crossings.
The trapRefusing to un-ship progress — the backward move is the point, and it's a lesson interviewers like: sometimes state must temporarily regress.
Frequently asked questions
Do QA interviews really include puzzle questions?
Less than they used to, but yes — especially at service companies, in campus rounds, and across South Asian hiring loops. Even where formal puzzles are gone, estimation and 'how would you approach' questions test the same skill: structured reasoning under ambiguity.
How do I answer a puzzle I can't solve?
Reason visibly: restate the puzzle, try a smaller version (2 doors, 3 coins), name the constraint that blocks you, and think aloud. Interviewers regularly pass candidates who reason well but finish late, and fail ones who blurt a memorised answer they can't defend.
Should I memorise puzzle answers before an interview?
Learn the reasoning patterns, not the answers: worst-case balancing, parity tricks, backward induction, using a second observable. A follow-up variant exposes memorisation in one move — 'now do it with 3 eggs' has ended many confident answers.
What is the most common interview puzzle?
The perennials: two eggs and 100 floors, 25 horses, three bulbs and switches, the two ropes, and Monty Hall. If you rehearse only five, rehearse those — aloud, with the reasoning, not just the number at the end.