A Snake-y Problem

A boy is standing at the foot of a flight of stairs. He has to reach to the 9 th { 9 }^\text{ 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 {7}^\text{th} stair. What is the number of ways in which he can get to the 9 th {9}^\text{th} stair while avoiding the 7 th {7}^\text{th} stair?


The answer is 13.

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.

1 solution

Yugesh Kothari
Mar 5, 2016

Let us consider a sequence a n { a }_{ n } which denotes the number of ways to reach the n t h {n}^{th} stair. Given the restriction to take steps of 1 1 or 2 2 , the recursion a n = a n 1 + a n 2 { a }_{ n }\ =\ { a }_{ n-1 }+{ a }_{ n-2 } is pretty obvious; as there are only 2 2 ways to get to the n t h {n}^{th} stair - by taking a single step from the n 1 t h {n-1}^{th} stair or taking a double step from the n 2 t h {n-2}^{th} stair. Also, it is clear that a 1 = 1 { a }_{ 1 }=1 and a 2 = 2 { a }_{ 2}=2 . Using the recursion, we find that a 6 = 13 { a }_{ 6 }=13 .

At the 6 t h {6}^{th} stair, the boy has only one choice, i.e., to jump directly to the 8 t h {8}^{th} stair, hence a 8 = 13 { a }_{ 8 }=13 . Again, to get to the 9 t h {9}^{th} stair, he has only one choice, i.e., take a single step and hence a 9 = 13 { a }_{ 9 }=13 .

Edit 1- It is mandatory for the boy to land on the 6 t h {6}^{th} stair because of the fact that he can only take steps of 1 1 or 2 2 . In order for him to reach the 9 t h {9}^{th} stair, he must either take 2 2 steps from the 7 t h {7}^{th} stair or 1 1 from the 8 t h {8}^{th} . Since, he cannot be on the 7 t h {7}^{th} stair at any point of time, it must be from the 8 t h {8}^{th} stair. Moreover, to reach the 8 t h {8}^{th} stair, again, he must do it from either the 7 t h {7}^{th} or the 6 t h {6}^{th} stair. Since the 7 t h {7}^{th} stair is out of question, it must be the 6 t h {6}^{th} stair.

Moderator note:

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 10 F 8 × F 1 = 55 21 × 2 = 13 F_{10} - F_8 \times F-1 = 55 - 21 \times 2 = 13

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 10 F 8 × F 1 = 55 21 × 2 = 13 F_{10} - F_8 \times F-1 = 55 - 21 \times 2 = 13

Calvin Lin Staff - 5 years, 3 months ago

@Calvin Lin Thank you for the feedback :)

Yugesh Kothari - 5 years, 3 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...