← All problems
Climbing Stairs
You are climbing a staircase with n steps; each move you may climb 1 or 2 steps. Count the number of distinct ways to reach the top. Recognize the recurrence before coding.
Complexity
Time O(n), Space O(1)
Common pitfalls
- Exponential recursion without memo
- Off-by-one base cases
Your solution
Log in to save your code and track progress.