Home
Topics
Practice
Roadmap
DSA Tracker
Code Editor
Tech Blogs
More
Sign in
Get started
Loading question...
Feedback
Climbing Stairs
Easy
00:00
0 users online
Share
Description
Solution
Submissions
Discussion
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?
Sample Input:
2
Sample Output:
2
Hints
Hint 1
This is a Fibonacci sequence problem
Hint 2
Use dynamic programming
Hint 3
ways(n) = ways(n-1) + ways(n-2)
Code Editor
Reset
Run
Save
Loading...