code.ashish.me

Atom feed

Recently added: 128 Longest Consecutive Sequence, 347 Top K Frequent Elements, 045 Jump Game 2, 228 Summary Ranges, 219 Contains Duplicate 2

04 Fiobancci

/**
 * Created by Ashish Patel
 * Copyright © 2017 ashish.me
 * ashishsushilpatel@gmail.com 
 */

 function generateFioSeries(n){
   const result = [0, 1];
   for(let i = 2; i<n ; i++){
     result.push(result[i-2] + result[i-1])
   }
   return result
 }

 console.log(generateFioSeries(8));

Created 2019-11-30T02:13:21+05:30 · Edit