47.2k views
4 votes
Bhadra’s house has a staircase with 12 steps. She can go down the steps one at a time or two at a time. For example, she could go down 1 step, then 1 step, then 2 steps, then 2, 2, 1, 1, 1, 1. In how many different ways can Bhadra go down the 12 steps, taking one or two steps at a time?How can you ensure that you have found all possible ways?

1 Answer

4 votes

Final answer:

Bhadra can go down the 12 steps in 233 different ways by taking one or two steps at a time. We can use a technique called dynamic programming for finding all possible ways.

Step-by-step explanation:

In order to find the different ways Bhadra can go down the 12 steps, taking one or two steps at a time, we can use a technique called dynamic programming. We will create an array to store the number of ways to reach each step. Initially, the number of ways to reach the first two steps is 1, since Bhadra can either take one or two steps. Then, for each subsequent step, the number of ways to reach that step is the sum of the number of ways to reach the previous step and the number of ways to reach the step two steps before.

  1. Initialize an array with 12 elements, representing each step.
  2. Set the first element to 1, since there is only one way to reach the first step.
  3. Set the second element to 1, since there is only one way to reach the second step.
  4. For each subsequent step, set the element to the sum of the previous element and the element two steps before.
  5. After looping through all the steps, the last element in the array will represent the total number of ways Bhadra can go down the 12 steps.

Using this method, we find that Bhadra can go down the 12 steps in 233 different ways.

User Nounoursnoir
by
8.3k points