Climbing Stairs
You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

30:00

Climbing Stairs
easy
Topics
Companies

You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

Example 1:
Input: 5
Output: 8
Constraints:
  • 1n451 \leq n \leq 45

Input
arr =5

0

0

0

1

0

2

0

3

0

4

0

5
Ways to reach step ...

0

Variables
VariableValue
n5
DepthFunction Call
Stack empty
0/8