- GATE CS
- 2026–27 pattern practice
- Algorithms
- Dynamic programming
- Easy
In how many distinct ways can you climb a staircase of 10 steps if each move climbs either 1 or 2 steps?
Algorithm Design
Pick an option to check your answer.
Answer: D. Solution
Let be the number of ways. The last move is either 1 step or 2 steps, so with and . This is the Fibonacci sequence: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, giving .
Why not the others
- is , one step short.
- is , one step too many.
- counts only the moves, not the ways to order them.