4 ms·A recursive memorized solution would be more elegant. Or even a mutually recursive solution.by smabie 6y agoA recursive memorized solution would be more elegant. Or even a mutually recursive solution.brundolf 6y agoIt would also be significantly slower and potentially limited by stack depth. Even with the memoization some of these sequences get pretty long.smabie 6y agoI mean, a tail recursive solution wouldn't be.