Carey Brown wrote:I don't see why you've turned this into a recursive problem
There are three kinds of actuaries: those who can count, and those who can't.
Carey Brown wrote:On line 42 you don't do anything with the newCount that is being returned.
Carey Brown wrote:The return at line 28 only unwinds the recursive calls one level and you eventually get back to a call you made on line 32, which, after the loops are exhausted will end up at the return at the very end.
Carey Brown wrote:I think you've got the gist of it now.
You can try
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:Indeed, nice and very readable. Here are two other ways that are O(n):
There are three kinds of actuaries: those who can count, and those who can't.
There are three kinds of actuaries: those who can count, and those who can't.
The knights of nee want a shrubbery. And a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|