Create a class with a method that calls itself to calculate the number of ways a person could climb a staircase of n steps if they can take 1 step at a time, 3 steps at a time, 5 steps at a time, or any combination thereof. Allow the user to specifiy the number of steps n. Assume at the top of the stairs there is a flat surface so it doesn't matter if the user oversteps on their last step.
I can think of how to do this if I were to set up while()s inside of while()s infinitely, but I don't know how to set it up in a recursive manner. I understand what recursion is, but I don't know what algorithm should be used for this problem.
I have installed all their components from store.rg-adguard.net.
I encountered an unusual issue with Microsoft Edge that I installed manually. When I disable “Shadows under windows” in the Windows performance settings, the menus in Edge display sharp corners instead of rounded ones.
I don't think the problem is related to a debloated version of Windows, as I experienced the same issue on a standard Windows machine in the past.
"AI has just arrived, how is it possible they're already losing jobs?” Huang said."
Hey idiot. It's called these stupid companies spending too much on your AI ###### and having to layoff employees to cover the cost.
Question
MacemanD
I can think of how to do this if I were to set up while()s inside of while()s infinitely, but I don't know how to set it up in a recursive manner. I understand what recursion is, but I don't know what algorithm should be used for this problem.
Any help is appreciated.
Link to comment
https://www.neowin.net/forum/topic/1235905-recursion-math-problem/Share on other sites
14 answers to this question
Recommended Posts