🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Dynamic Programming Quiz: all 8 questions

Dynamic Programming Quiz · Question 2 of 8

In how many distinct ways can you climb 5 stairs taking 1 or 2 steps at a time?

In how many distinct ways can you climb 5 stairs taking 1 or 2 steps at a time?

Answer & explanation

Correct answer: 8

dp: 1, 1, 2, 3, 5, 8 for n = 0…5 — it's the Fibonacci sequence.

Can you get the rest right without peeking?

Take the timed Dynamic Programming Quiz quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →