#8 most askedVery commonEasy1D DP
Climbing Stairs
New to 1D DP? Learn it from scratch firstDynamic Programming, Demystified โ
๐ข Asked in real interviews
No reports yet. Were you asked this? Be the first to say where.You can climb 1 or 2 steps at a time. How many different ways are there to climb n steps?
climb_stairs(3) โ 3 (1+1+1, 1+2, 2+1).
๐งช Practice
Write your solution, then press Run tests. Explain your approach out loud as you go.
def climb_stairs(n):
pass
Output appears here. Press Run or Ctrl/โ + Enter.
Try it first. Struggling for a few minutes is how it sticks.