Climbing Stairs

Easy · Dynamic Programming · Math · Dynamic Programming · Memoization

Problem

You are climbing a staircase of n steps. Each move takes you up 1 or 2 steps. How many distinct ways can you reach the top?

Examples

Input: n = 2
Output: 2

1+1, or 2.

Input: n = 3
Output: 3

1+1+1, 1+2, 2+1.

Constraints

Approaches

Related problems

Start free on Cariara · Coding problems · System design studio

Starting Python
No results yet.

          
↑↓ move ↵ open esc close

Labs

Loading labs…

Run with your own input

Starting Python

Loading Python…