๐ผ Job interview logic puzzles with full solutions
These puzzles still show up in tech, data and product interviews. Each one has a hint and a full, step-by-step explanation.
Three boxes are labeled "Apples," "Oranges" and "Mixed." Every label is wrong. You may take out one fruit from one box without looking inside. How do you fix all the labels?
๐ก Hint
Which box gives you the most information from one fruit?
Show the answer
Take a fruit from the box labeled "Mixed." Its label is wrong, so it holds only one kind of fruit. If you pull an apple, that box is Apples. The box labeled "Oranges" can't be oranges (wrong label) and can't be apples (already found), so it is Mixed. The last box is Oranges. The same logic works if you pull an orange.
You have two ropes. Each burns for exactly one hour, but unevenly - half of a rope might burn in 5 minutes and the rest in 55. How do you measure exactly 45 minutes?
๐ก Hint
What happens when you light a rope at both ends?
Show the answer
Light rope A at both ends and rope B at one end. Rope A burns out in exactly 30 minutes. At that moment, light the other end of rope B. It had 30 minutes of burning left, and burning from both ends cuts that to 15 minutes. Total: 30 + 15 = 45 minutes.
You have 8 balls that look the same. One is slightly heavier. Using a balance scale only twice, how do you find the heavy ball?
๐ก Hint
You don't have to put every ball on the scale.
Show the answer
Split them into groups of 3, 3 and 2. Weigh 3 against 3. If they balance, the heavy ball is in the group of 2; weigh those against each other. If one side is heavier, take two balls from that side and weigh them. If they balance, the third ball is heavy; if not, the scale shows you which one.
Three switches outside a closed room control three light bulbs inside. You can flip the switches as much as you like, but you can enter the room only once. How do you tell which switch controls which bulb?
๐ก Hint
A bulb gives off more than light.
Show the answer
Turn on switch 1 and wait a few minutes. Turn it off, turn on switch 2, and walk in. The bulb that is on belongs to switch 2. The bulb that is off but warm belongs to switch 1. The bulb that is off and cold belongs to switch 3.
100 doors in a hallway are closed. Person 1 opens every door. Person 2 toggles every 2nd door, person 3 every 3rd door, and so on up to person 100. How many doors are open at the end?
๐ก Hint
How many times is door 12 touched? Door 16?
Show the answer
10 doors: numbers 1, 4, 9, 16, 25, 36, 49, 64, 81 and 100. A door is toggled once for every divisor of its number. Divisors come in pairs, except for perfect squares, which have an odd number of divisors - so only those doors end up open.
You have a 3-gallon jug, a 5-gallon jug and unlimited water. How do you measure exactly 4 gallons?
๐ก Hint
Start with the bigger jug.
Show the answer
Fill the 5-gallon jug and pour it into the 3-gallon jug, leaving 2 gallons. Empty the 3-gallon jug and pour the 2 gallons into it. Fill the 5-gallon jug again and top up the 3-gallon jug, which needs just 1 more gallon. Exactly 4 gallons are left in the 5-gallon jug.
Four people must cross a bridge at night with one flashlight. At most two can cross at once, and anyone crossing needs the flashlight. They take 1, 2, 5 and 10 minutes, and a pair moves at the slower person's speed. What is the shortest total time?
๐ก Hint
The two slowest people should cross together.
Show the answer
17 minutes. 1 and 2 cross (2). 1 returns (1). 5 and 10 cross together (10). 2 returns (2). 1 and 2 cross (2). Total: 2 + 1 + 10 + 2 + 2 = 17.
You have 25 horses and a track that fits 5 at a time. There is no stopwatch - you only see the finishing order. What is the fewest races needed to find the 3 fastest horses?
๐ก Hint
After the winners' race, which horses can no longer be in the top 3?
Show the answer
7 races. Run 5 races, one per group of 5. Race 6: the 5 group winners. Call their groups A, B and C by finishing order; groups D and E are out. The fastest horse is A1. Only A2, A3, B1, B2 and C1 can still be 2nd or 3rd, so race 7 is those five, and its top two are the 2nd and 3rd fastest overall.
You have two identical eggs and a 100-story building. What is the fewest drops that guarantees you find the highest floor an egg can survive, even in the worst case?
๐ก Hint
If the first egg breaks, how many drops are left for the second?
Show the answer
14 drops. Drop the first egg from floor 14, then 27, 39, 50, 60, 69, 77, 84, 90, 95, 99 and 100, shrinking the jump by one each time. When it breaks, use the second egg floor by floor from the last safe floor. Every path takes at most 14 drops, because 14 + 13 + ... + 1 = 105, which covers 100 floors (13 would cover only 91).
How many times a day do the hour and minute hands of a clock overlap?
๐ก Hint
Count carefully between 11 and 1.
Show the answer
22 times. In 12 hours they overlap 11 times, not 12, because between 11:00 and 1:00 they meet only once, at 12:00. Twice a day makes 22.
What is the angle between the hour and minute hands at 3:15?
๐ก Hint
The hour hand doesn't stay still.
Show the answer
7.5 degrees. The minute hand points at 3 (90 degrees). The hour hand has moved a quarter of the way from 3 to 4. Each hour is 30 degrees, so it moved 7.5 degrees past the minute hand.
In a dark room, a drawer holds 10 black socks and 10 white socks. How many socks must you take out to be sure you have a matching pair?
๐ก Hint
How many colors are there?
Show the answer
3. With only two colors, any 3 socks must include at least two of the same color.
You have a coin that may be biased, and you don't know which way. How can you use it to make a perfectly fair 50-50 choice?
๐ก Hint
Look for two outcomes that are always equally likely.
Show the answer
Flip it twice. Heads-then-tails means option A; tails-then-heads means option B. If both flips match, start over. Heads-tails and tails-heads always have the same probability, even with a biased coin.
Why are manhole covers round?
๐ก Hint
Picture a square cover turned on its diagonal.
Show the answer
A circle can't fall through its own opening at any angle, while a square cover can drop through diagonally. Round covers are also easy to roll and don't need to be lined up when they're put back.
How many zeros are at the end of 100! (100 factorial)?
๐ก Hint
Which is rarer as a factor: 2 or 5?
Show the answer
24. Each trailing zero comes from a 10 = 2 ร 5, and there are more 2s than 5s. Count the 5s: 100 รท 5 = 20 numbers give one 5, and 100 รท 25 = 4 of them give an extra 5. 20 + 4 = 24.
Two trains are 100 miles apart and head toward each other at 50 mph each. A fly starts at one train and zips back and forth between them at 75 mph until they meet. How far does the fly travel?
๐ก Hint
How long does the fly fly?
Show the answer
75 miles. The trains close the gap at 100 mph, so they meet in exactly 1 hour. The fly flies the whole hour at 75 mph. No need to add up the zigzags.
Quick answers
Three boxes are labeled "Apples," "Oranges" and "Mixed." Every label is wrong. You may take out one fruit from one box without looking inside. How do you fix all the labels?
Take a fruit from the box labeled "Mixed." Its label is wrong, so it holds only one kind of fruit. If you pull an apple, that box is Apples. The box labeled "Oranges" can't be oranges (wrong label) and can't be apples (already found), so it is Mixed. The last box is Oranges. The same logic works if you pull an orange.
You have two ropes. Each burns for exactly one hour, but unevenly - half of a rope might burn in 5 minutes and the rest in 55. How do you measure exactly 45 minutes?
Light rope A at both ends and rope B at one end. Rope A burns out in exactly 30 minutes. At that moment, light the other end of rope B. It had 30 minutes of burning left, and burning from both ends cuts that to 15 minutes. Total: 30 + 15 = 45 minutes.
You have 8 balls that look the same. One is slightly heavier. Using a balance scale only twice, how do you find the heavy ball?
Split them into groups of 3, 3 and 2. Weigh 3 against 3. If they balance, the heavy ball is in the group of 2; weigh those against each other. If one side is heavier, take two balls from that side and weigh them. If they balance, the third ball is heavy; if not, the scale shows you which one.
Three switches outside a closed room control three light bulbs inside. You can flip the switches as much as you like, but you can enter the room only once. How do you tell which switch controls which bulb?
Turn on switch 1 and wait a few minutes. Turn it off, turn on switch 2, and walk in. The bulb that is on belongs to switch 2. The bulb that is off but warm belongs to switch 1. The bulb that is off and cold belongs to switch 3.
100 doors in a hallway are closed. Person 1 opens every door. Person 2 toggles every 2nd door, person 3 every 3rd door, and so on up to person 100. How many doors are open at the end?
10 doors: numbers 1, 4, 9, 16, 25, 36, 49, 64, 81 and 100. A door is toggled once for every divisor of its number. Divisors come in pairs, except for perfect squares, which have an odd number of divisors - so only those doors end up open.