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 stepsLet 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.

Related Oxbridge Preparation Mentoring answers

All answers ▸

What things can I be asked about at interview (for Cambridge Economics)?


I've heard that interviewers ask strange, out-of-the-blue questions to catch students off-guard. How do I circumvent this?


A newspaper runs a competition in which every entrant guesses an integer between 0 and 100 inclusive, the winner of the competition is the person who's guess is closest to 2/3rds of the average integer guessed, what number do you guess?


Suggest why DNA is a more suitable long-term storage molecule for genetic information than RNA.