#6

Climbing Stairs

Easy
All Problems

6. Climbing Stairs#70

Easy🧠 Dynamic ProgrammingFibonacci DP

You can climb 1 or 2 steps at a time. How many distinct ways can you climb to the top?

Examples

Example 1:
Input: [2]
Output: 2
Example 2:
Input: [3]
Output: 3
Example 3:
Input: [1]
Output: 1

Why learn this

The gentlest introduction to DP — it's just Fibonacci with a story. Gateway to dynamic programming.

Dynamic ProgrammingFibonacciMemoization
Python 3Loading Python engine...
Click "Run Code" to test your solution