A staircase has n steps. You can scale the stairs by taking steps one or two at a time. How many ways are there to scale the steps?

If there are 0 steps, there is 1 possibility (you are already done).If there is 1 step, there is 1 possibility (you take one step).
If there are n steps, your first choice is either 1 step or 2 steps:Choice 1: the problem now exists for n-1 stepsChoice 2: the problem now exists for n-2 steps
Let f(x) be the number of ways of scaling x steps. You can now say that f(x) = f(x-1) + f(x-2) - the Fibonacci sequence.
This is an example of a dynamic programming question - a computer science topic for first-year Cambridge computer scientists, and my first interview question.

Answered by Oxbridge Preparation tutor

2573 Views

See similar Oxbridge Preparation Mentoring tutors

Related Oxbridge Preparation Mentoring answers

All answers ▸

How can I prepare for interviews?


In order to be a successful leader, is it better to be loved or feared? (example of a question designed to evaluate reasoning skills- TSA/ Ox Philosophy Test style)


A hypertensive patient asks you to choose his treatment without disclosing potential side-effects of different options as that would only make him anxious, he claims. Which medical and ethical issues would you investigate before proceeding?


Is it easier for organisms to live on land or in the sea?


We're here to help

contact us iconContact ustelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

MyTutor is part of the IXL family of brands:

© 2026 by IXL Learning