Dashboard
LC #70
Climbing Stairs
Pattern · ?AmazonGoogleBloombergMicrosoft
Problem
Count the number of ways to climb n stairs, taking 1 or 2 steps at a time.
Constraints
- 1 ≤ n ≤ 45
Example
- Input
- n = 5
- Output
- 8
- Why
- Ways: 1+1+1+1+1, 1+1+1+2, 1+1+2+1, 1+2+1+1, 2+1+1+1, 1+2+2, 2+1+2, 2+2+1 = 8
Spot the pattern
Which pattern cracks it?
Hints
One at a time