Question #70: If a person can climb either one stair at a time or 2 stairs at a time, then how many total no. of ways will be there to climb 5 stairs?

3

4

5

8

Solution: The problem can be solved as follows. To reach the last step of the stair (n), the person can either climb one step or two steps. Hence, if f(n) is the no. of ways to reach n steps, f(n-1) is the no. of ways to reach n-1 steps and f(n-2) is the no. of ways to reach n-2 steps, then

f(n) = f(n-1) + f(n-2)

Hence, f(5) can be calculated as:

f(5) = f(4) + f(3)

f(5) = f(3) + f(2) + f(2) + f(1)

f(5) = f(2) + f(1) + f(2) + f(2) + f(1)

Going to the base condition, f(1) = 1 as there is only one way to climb one step. But f(2) will be 2 since there are two ways: take one step twice and take two steps at once.

Hence, f(5) will be 8 based on the above equation. Hence the correct answer is option 4.