Finding the First Solution
The first step of the FAST method is taking a naive or brute force solution and making it dynamic. So we need to first find that brute force solution for the nth Fibonacci number.
This solution is not as efficient as it could be. But it won't matter right now since we're still going to optimize it.
xxxxxxxxxx
function fib(n) {
if (n === 0) return 0;
if (n === 1) return 1;
​
return fib(n - 1) + fib(n - 2);
}
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment