Click here to Skip to main content
15,886,842 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
If a child is climbing a stair case with “n” steps, find the maximum number of possibilities (how many different ways he can climb the stair case)

What I have tried:

I spend some time on the above problem, but don't know how to proceed ?
Posted
Updated 7-Mar-20 9:38am
Comments
PIEBALDconsult 9-Dec-20 19:02pm    
That's neither permutations nor combinations, because those don't allow duplication.

Quote:
I spend some time on the above problem, but don't know how to proceed ?

The first step is to figure out the maths.
For 1 step, answer is 1 because {1}
For 2 step, answer is 2 because {1,1}, {2}
For 3 step, answer is 4 because {1,1,1}, {1,2}, {2,1}, {3}
...
There you find a formula or you find a way to enumerate all possibilities and count them.
At this point, you should have a pretty good idea of how to program it.
 
Share this answer
 
Comments
Richard Deeming 9-Mar-20 17:17pm    
Of course, this assumes the child has infinitely long legs. :)
Patrice T 9-Mar-20 18:57pm    
Yes :)
Quite a neck breaker after 4 steps.
PIEBALDconsult 9-Dec-20 18:55pm    
Hopping... crawling... scooting...
Patrice T 9-Dec-20 19:03pm    
May be child is Mandalorian :)
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900