Let there be light.
doco
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Originally posted by Joseph Russell:
My problem is not how to solve 4b, I solved a while ago. Rather it is do I solve it recursively or not. This nitpick seems to indicate that a recursive method is the way to go while this thread says not too. I do not want to proceed coding this problem until I know for sure what is the most efficient or accepted way.
Nitpick:
"Instead of a switch statement, you could have workIt return a number value to be used in the next call to workIt, and put the number %= ... equation in the method itself."
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
In this particular case an iterative approach works just as well as a recursive approach. A method does not need to be recursive to use a value that a previous call to the same method returns.
Water! People swim in water! Even tiny ads swim in water:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
|