4 ms·
There should be a fourth level where they use the closed form solution to get to the solution they want without any recursion or looping for reasonable values o
by WJW 6y ago
There should be a fourth level where they use the closed form solution to get to the solution they want without any recursion or looping for reasonable values of N. Maybe even a fifth level using the O(log(N)) matrix exponentiation method.
- sk5t 6y agoI’m a bit puzzled at the idea of using recursion for an infinite sequence (did OP mean factorial?). Give me a LazyList / generator / IEnumerable instead any day for Fib.