Let me introduce you The Very Bad Fibonacci Implementation:
function fib(n) {
if (n <= 1) {
return 1
}
return fib(n - 2) + fib(n - 1)
}
The first question is very simple:
Q1. What's wrong with this implementation and how to fix it?
I know it's too easy 😆 That's why here's another for you:
Q2. What's it complexity in terms of Big O? How to estimate and prove it?
Answers will be published soon ⏳
Top comments (0)