8 practice problems
Logic puzzle and brain teaser interview questions: 8 with answers
Logic puzzles test whether you can turn a wordy setup into rules and follow them without skipping a step. Each of these 8 has one right answer: pick it, check it, then read the method, because the method is what an interviewer listens for.
How do you approach these?
Write the constraints down as rules. Assume one case and follow it until it breaks or closes. Check your answer against every rule before you say it.
8 questions, one at a time
Pick a pace. The timer stops when you check an answer, and the worked method opens straight away. Nothing is saved or sent anywhere.
Keys: 1 to 4 pick an option, Enter checks and moves on.
All the answers, worked through
Every problem on this page with its answer and the method, for after the test or for revision.
1 · 4 minA group of six people are sitting in a circle. Each person is either a truth-teller or a liar. Each person says, 'The person to my right is a liar.' How many truth-tellers are in the circle?
Answer
Three
How to get there
- If person A is a truth-teller, B must be a liar.
- If B is a liar, his statement that C is a liar must be false, so C is a truth-teller.
- This creates a T-L-T-L-T-L pattern.
- Total count is 3 truth-tellers and 3 liars.
Mastery Point: Alternating logical states in closed loops.
2 · 4 minSix books are on a shelf. A is to the left of B. C is to the right of D. E is to the left of F. D is to the right of B. F is to the left of A. What is the order of the books?
Answer
E-F-A-B-D-C
How to get there
- Combine relationships: F < A < B.
- Combine with D and C: D < C.
- Link the two chains: B < D.
- Full sequence: E < F < A < B < D < C.
- Verification: All conditions met.
Mastery Point: Transitive relationship chaining.
3 · 4 minA logic gate array processes three inputs X, Y, and Z. The output is 'True' only if at least two inputs are 'True', but the system fails if all three are 'True'. If X is currently 'True' and the system is outputting 'True', what are the possible states of Y and Z?
Answer
One True, one False
How to get there
- Define the truth table: Output is True if (X=T, Y=T, Z=F) or (X=T, Y=F, Z=T) or (X=F, Y=T, Z=T).
- System fails if (X=T, Y=T, Z=T).
- Given X is True, we must avoid the failure state.
- To output True, exactly one of Y or Z must be True and the other must be False.
Mastery Point: Boolean logic requires checking both inclusion and exclusion criteria.
4 · 4 minThree runners (P, Q, R) finish a race. We know P did not finish first. Q did not finish second. R finished after P. What is the finishing order?
Answer
Q, P, R
How to get there
- Positions: 1st, 2nd, 3rd.
- R after P means P > R.
- P is not 1st.
- If P is 2nd, R must be 3rd.
- That leaves Q for 1st.
- Check constraint: Q is not 2nd. 1st is Q, so this is valid.
Mastery Point: Eliminate impossibilities until one permutation remains.
5 · 4 minA sequence follows: 2, 6, 12, 20, 30. What is the next number in the sequence and what is the underlying logic?
Answer
42, n^2 + n
How to get there
- Calculate differences: 6-2=4, 12-6=6, 20-12=8, 30-20=10.
- Notice the differences are consecutive even numbers (4, 6, 8, 10).
- The next difference must be 12. 30+12=42.
- Alternatively, use n^2 + n where n is the index starting at 1 (1+1=2, 4+2=6, 9+3=12, 16+4=20, 25+5=30, 36+6=42).
Mastery Point: Pattern recognition via differential analysis.
6 · 4 minThree light switches outside a room control three light bulbs inside. You can flip the switches as much as you want but can enter the room only once. How do you determine which switch controls which bulb if the bulbs also emit heat?
Answer
Use heat as a secondary identifier
How to get there
- Turn Switch A on for five minutes, then turn it off.
- Turn Switch B on and leave it on.
- Enter the room.
- The bulb that is on is Switch B.
- The bulb that is off but warm is Switch A.
- The bulb that is off and cold is Switch C.
Mastery Point: Expanding the dimensionality of the solution space beyond visual feedback.
7 · 4 minA gardener has a square plot of land. They want to plant 10 trees such that there are 5 rows with 4 trees in each row. How is this possible?
Answer
Five-pointed star arrangement
How to get there
- Visualize a five-pointed star (pentagram).
- Place a tree at each of the 5 points.
- Place a tree at each of the 5 intersections of the lines forming the star.
- Each line of the star now contains 4 trees.
Mastery Point: Spatial thinking outside of grid-based alignment.
8 · 4 minTwo people play a game where they take turns removing 1, 2, or 3 stones from a pile of 15. The person who takes the last stone wins. If you go first, what is your strategy to win?
Answer
Take 3 stones initially
How to get there
- This is a game of Nim variant.
- Identify the target count to leave the opponent: multiples of 4 (n+1).
- To win, leave the opponent with 12 stones, then 8, then 4.
- First move: remove 3 stones to leave 12.
Mastery Point: Establishing a winning state through modulo arithmetic.
One question, two answers
A weak answer, why it scores low, and the strong one. Under a minute each.
The liars' circle
Three switches, one visit
The 15-stone game
Practice under the clock
The gym runs the same problems timed, keeps your history and shows which type to work on next.
Open the free gym