S
All challenges
Practice
Home
Blog
Practice
Examples
Feedback
Climbing Stairs
00:00
Start
00:00
Sign in
Problem
Hints
3
Solution
History
Easy
Dynamic Programming
Fibonacci
Amazon
Google
Adobe
Count distinct ways to climb n stairs where you can take 1 or 2 steps at a time.
Examples
Example 1
Input →
n=2
Output →
2
Note:
1+1 or 2
Example 2
Input →
n=3
Output →
3
Note:
1+1+1, 1+2, 2+1
Example 3
Input →
n=5
Output →
8
Example 4
Input →
n=1
Output →
1
JavaScript
Python
Java (Coming soon)
C (Coming soon)
C++ (Coming soon)
Reset
Run
Submit
Cases
Results