Hi,here is another interesting problem that will make you think.
The tower of happiness is located in the garden of effort.Happiness is waiting for you in the top chamber of the tower.The stairs that lead you to the chamber has N steps and you are allowed to climb up one or two steps from your current location. The door of the chamber will open only if you could climb secrt combination. Of course, finding this secret combination is a matter of chance. For instance, you may choose one of three step stairs: 0 1 2 3,or 0 2 3 or 0 1 3.
sample input: 3
sample output: 3
Tahir33 0 Newbie Poster
Recommended Answers
Jump to PostOk, does the tower of happiness has all the happiness that I need ? Does it include megan fox in there? How about the best food in the world? How about a infinite power machine? So seriously, whats your problem?
Jump to PostI really don't understand the statement of the problem
Jump to Postyeah you just have to find how many different ways you can climb the ladder OK?
:yawn:It's multi sets of the number of steps available. If there are 10 steps, the shortest distance you can get to the top is 5. If there's 11 steps, the shortest distance is …
Jump to PostIt is correct ... if the steps are 1, 2, 3, 4 then 2 (taking 2 steps) then 4 (taking 2 steps) is a legal move.
1,3 is illegal because you don't end on 4.
3,4 is illegal because to get to step 3 is to many steps.…
Jump to Postno there's no such condition that allows you move only oe or only two you can use both of them
If you reread the post, I account for all possible moves either taking 1 step or 2 steps. I did make one mistake in saying divide by 2, but you …
All 18 Replies
mrnutty 761 Senior Poster
stevanity 4 Posting Whiz in Training
Tahir33 0 Newbie Poster
Tahir33 0 Newbie Poster
stevanity 4 Posting Whiz in Training
Tahir33 0 Newbie Poster
kes166 37 Practically a Master Poster
Tahir33 0 Newbie Poster
kes166 37 Practically a Master Poster
Tahir33 0 Newbie Poster
kes166 37 Practically a Master Poster
Tahir33 0 Newbie Poster
kes166 commented: You are obviously attempting to troll +0
Tahir33 0 Newbie Poster
rpdm 4 Newbie Poster
Tahir33 0 Newbie Poster
rpdm 4 Newbie Poster
kes166 37 Practically a Master Poster
Tahir33 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.