A boy is standing at the foot of a flight of stairs. He has to reach to the 9 th stair by taking steps of 1 or 2 only. He would have done it easily if there wasn't a snake of the 7 th stair. What is the number of ways in which he can get to the 9 th stair while avoiding the 7 th stair?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
This solution is incomplete. You have to explain why "the boy must land on the 6th step", in order to justify the 2nd paragraph.
An alternative approach would be to ignore the snake and count the complement. In this case, we will get F 1 0 − F 8 × F − 1 = 5 5 − 2 1 × 2 = 1 3
This solution is incomplete. You have to explain why "the boy must land on the 6th step", in order to justify the 2nd paragraph.
An alternative approach would be to ignore the snake and count the complement. In this case, we will get F 1 0 − F 8 × F − 1 = 5 5 − 2 1 × 2 = 1 3
@Calvin Lin Thank you for the feedback :)
Problem Loading...
Note Loading...
Set Loading...
Let us consider a sequence a n which denotes the number of ways to reach the n t h stair. Given the restriction to take steps of 1 or 2 , the recursion a n = a n − 1 + a n − 2 is pretty obvious; as there are only 2 ways to get to the n t h stair - by taking a single step from the n − 1 t h stair or taking a double step from the n − 2 t h stair. Also, it is clear that a 1 = 1 and a 2 = 2 . Using the recursion, we find that a 6 = 1 3 .
At the 6 t h stair, the boy has only one choice, i.e., to jump directly to the 8 t h stair, hence a 8 = 1 3 . Again, to get to the 9 t h stair, he has only one choice, i.e., take a single step and hence a 9 = 1 3 .
Edit 1- It is mandatory for the boy to land on the 6 t h stair because of the fact that he can only take steps of 1 or 2 . In order for him to reach the 9 t h stair, he must either take 2 steps from the 7 t h stair or 1 from the 8 t h . Since, he cannot be on the 7 t h stair at any point of time, it must be from the 8 t h stair. Moreover, to reach the 8 t h stair, again, he must do it from either the 7 t h or the 6 t h stair. Since the 7 t h stair is out of question, it must be the 6 t h stair.