Computer Science interview problems
Puzzles and algorithms: find a method, then show it is the best. Type your thinking, take a hint when you are stuck, then answer the follow-ups.
The problems
The heavy coin
FreeYou have 9 coins that look the same. One is slightly heavier. With a balance scale, what is the smallest number of weighings that always finds it?
Try it freeClimbing stairs
In the rehearsalYou climb a staircase of 10 steps, taking 1 or 2 steps at a time. How many different ways are there to reach the top?
Guess my number
In the rehearsalI think of a whole number from 1 to 1,000. You may ask yes or no questions. How many questions do you need, in the worst case, to be sure of finding it?
A hundred lockers
In the rehearsalA corridor has 100 closed lockers. Person 1 opens every locker. Person 2 toggles every 2nd locker, person 3 every 3rd, and so on up to person 100. Which lockers are open at the end?
The missing number
In the rehearsalA list holds every whole number from 1 to n except one, in a random order. How would you find the missing number, using very little extra memory?
Does the robot escape?
In the rehearsalA robot starts at (0, 0) facing north on an endless grid. F moves it one square forward, L and R turn it 90° left or right on the spot. It repeats the program FFRFFL forever. Does it stay inside some fixed region, or wander off?
Knights and knaves
In the rehearsalOn an island, knights always tell the truth and knaves always lie. A says: 'B is a knave.' B says: 'A and I are the same kind.' What are A and B?
Tower of Hanoi
In the rehearsalThree pegs, and n discs of different sizes stacked on the first peg, largest at the bottom. Move them all to the third peg, one disc at a time, never putting a larger disc on a smaller one. How many moves does it take?
Rehearse all 8
Hints, follow-ups and Mia's marks on every attempt, until 31 December.
Oxbridge Interview Rehearsal: two subjects
£199 once. No VAT is charged.
Rehearse every problem in two subjects you choose, with hints, follow-ups and Mia's marks, until your interviews.
- All 8 problems in each of your two subjects, chosen after you pay
- Hints when you are stuck, then the tutor's follow-up questions
- Mia's marks on every attempt: thinking aloud, using hints, checking, reasoning
- Your next problem picked from your weakest skill
- Every attempt saved, with re-attempts side by side
Access until 31 December 2026. Choose your subjects after paying. Full refund within 14 days, for any reason.
By paying you agree to our Terms and get access straight away, which ends your 14-day cancellation right.Oxbridge Interview Rehearsal: all subjects
£299 once. No VAT is charged.
Every problem in all seven subjects, for joint courses and for practising beyond your own subject.
- All 56 problems: Maths, Computer Science, Engineering, Physics, Economics, Law and PPE
- Hints when you are stuck, then the tutor's follow-up questions
- Mia's marks on every attempt: thinking aloud, using hints, checking, reasoning
- Your next problem picked from your weakest skill
- Every attempt saved, with re-attempts side by side
Access until 31 December 2026. Full refund within 14 days, for any reason.
By paying you agree to our Terms and get access straight away, which ends your 14-day cancellation right.What the universities say
“You may be asked to explore unfamiliar ideas, think through problems aloud or consider new perspectives.”
University of Oxford: Interviews“Students do make mistakes, and that's fine”
“It's not assumed that a less-talented student will need more help on any given problem”
University of Oxford: Sample interview questions“we may ask you to solve a problem and talk us through your thought processes”
Oxford Mathematical Institute: Interviews“Our tutors are not mind readers, so if you don't say anything our tutors can't tell what you are thinking!”
Oxford Computer Science: How to apply“the people interviewing you are interested in how you work out your answers and how you think”
University of Cambridge: Preparing for your interview