Created
February 23, 2022 16:54
-
-
Save gpDA/b5ca83cec62a08380dbb119dbf0a065f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const findFibonacci = (n) => { | |
if (n == 1) return [0, 1]; | |
let res = findFibonacci(n-1); | |
res.push(res[res.length - 1] + res[res.length - 2]) | |
return res; | |
} | |
console.log(findFibonacci(5)); // [0, 1, 1, 2, 3, 5] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment