Let us assume a person climbing the stairs can take one stair or two stairs at…
2021
Let us assume a person climbing the stairs can take one stair or two stairs at a time. How many ways can this person climb a flight of eight stairs?
- A.
21
- B.
24
- C.
31
- D.
34
Attempted by 100 students.
Show answer & explanation
Correct answer: D
Answer: 34
Reasoning using recurrence:
Let ways(n) be the number of ways to climb n stairs when you can take 1 or 2 steps at a time. For n>2, any valid sequence either starts with a single step (then there are ways(n-1) ways for the rest) or starts with a double step (then there are ways(n-2) ways for the rest). So:
ways(n) = ways(n-1) + ways(n-2)
Base values: ways(1) = 1 (only one single step), ways(2) = 2 (either two singles or one double).
Compute up to n = 8 using the recurrence:
ways(1)=1, ways(2)=2, ways(3)=3, ways(4)=5, ways(5)=8, ways(6)=13, ways(7)=21, ways(8)=34
Combinatorial check (alternate method):
If there are 0 double steps, all 8 are single steps: C(8,0) = 1 way.
If there is 1 double step, there are 7 moves in total and choose its position: C(7,1) = 7 ways.
If there are 2 double steps, there are 6 moves total: C(6,2) = 15 ways.
If there are 3 double steps, there are 5 moves total: C(5,3) = 10 ways.
If there are 4 double steps, there are 4 moves total: C(4,4) = 1 way.
Summing these counts: 1 + 7 + 15 + 10 + 1 = 34, confirming the recurrence result.
A video solution is available for this question — log in and enroll to watch it.