Guest User

Untitled

a guest
Nov 14th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. function fib(n,memo=[]){
  2.  
  3. if(memo[n]!==undefined) return memo[n];
  4. if(n<=2) return 1;
  5. let res = fib(n-1, memo) + fib(n-2,memo)
  6. memo[n]=res;
  7. return res;
  8. }
  9.  
  10.  
  11. console.log(fib(100));
Add Comment
Please, Sign In to add comment