Agreed. Thanks for the optimization. It had occurred to me, but I was already overstepping the bounds a bit - except the OP was sooooo close.
Type: Posts; User: GregBrannon
Agreed. Thanks for the optimization. It had occurred to me, but I was already overstepping the bounds a bit - except the OP was sooooo close.
On one hand, you're very close. On the other hand, there are some things I would do differently:
1. Some recusive methods return a value. This one doesn't need to.
2. The base case should be...
Why didn't you show that code that almost or partly worked? I don't see any recursion here, and what is the method evens()?