Answer the question
In order to leave comments, you need to log in
How to calculate fibonacci numbers without recursion?
We need to write a function that will return an array of Fibonacci numbers without recursion.
This is where I got stuck. As a matter of fact if to do with a recursion that turns out at me such.
const fibo = n => {
let fib = [1, 1];
for (let i = 2; i < n; i++) {
fib[i] = fib[i - 2] + fib[i - 1];
}
return fib;
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question