3 ms·
Is that really tail recursion though ? Seems like you are making two recursive calls to fib(). I thought tail recursion requires a single final call to recurs
by naveen99 9y ago
Is that really tail recursion though ? Seems like you are making two recursive calls to fib(). I thought tail recursion requires a single final call to recursive function.
Your memorization helps, but seems you will still run out of stack space if you call it with a big number without a warm up.
- kahnjw 9y agoI don’t think op is claiming that method is tail recursive, just pointing out you can get away with using recursion and LRU cache.