Nice series!
Would like to share for others that the nth Fibonacci number can be calculated in O(1) with the Binet Formula as I’ve learned it recently too.
Here’s my version of it:
/**
* Binet's Formula - Calculate the Fib of the nth 'n' term
*/constfibOfN=n=>{const{pow,sqrt,floor}=Math;constPhi=(sqrt(5)+1)/2;constfibOfN=(pow(Phi,n)-pow(-Phi,-n))/sqrt(5);returnfloor(fibOfN);};
I am a full stack engineer, passionate about solving complex problems and collaborating with driven teams! I have 4+ years of experience working at small to mid sized startups.
Nice series!
Would like to share for others that the nth Fibonacci number can be calculated in O(1) with the Binet Formula as I’ve learned it recently too.
Here’s my version of it:
Nice!