Memoization and the fibonacci sequence in Javascript

preview_player
Показать описание
Quick video on memoization and the fibonacci sequence in Javascript.
#javascript #algorithm #memoization

Рекомендации по теме
Комментарии
Автор

Thanks for the video! Why not checking for the presence of "index-1" and "index-2" in the cache?

antoniofranco
Автор

when using something like cache = cache || [ ] ... what does this mean?

inactiveaccount
Автор

const fibonacci = (term, sequence) => {
if (sequence.length === term) return sequence[sequence.length - 1];

- 2] + sequence[sequence.length - 1]);

return fibonacci(term, sequence);
};

console.log(fibonacci(364, [0, 1]));

OynarsanOyna