We need to climb 10 stairs. At each support, we can walk one stair or you can jump two stairs.
In what number alternative ways we'll climb ten stairs?
How to solve this problem easily using less calculation?
We need to climb 10 stairs. At each support, we can walk one stair or you can jump two stairs.
In what number alternative ways we'll climb ten stairs?
How to solve this problem easily using less calculation?
Copyright © 2021 JogjaFile Inc.
Consider $f(n)$ as the number of ways to climb $n$ stairs. We note that $f(1) = 1$ and $f(2) = 2$. Now consider the case when $n>2$. The first action one can take is climb $1$ or $2$ stairs.
Suppose $1$ stair is climbed for the first step. Then there are $n-1$ stairs left and thus there are $f(n-1)$ alternate ways to climb $n$ stairs with the first step being to take $1$ stair.
Similarly, there are $f(n-2)$ alternate ways to climb $n$ stairs with the first step being to take $2$ stairs.
Then we have $$f(n) = f(n-1) + f(n-2)$$
This is the Fibonacci relation. Thus, $f(10) = 89$.