DEV Community

NDONGO TONUX SAMB
NDONGO TONUX SAMB

Posted on

Fibonacci in Kotlin

The Fibonacci sequence is a sequence of integers in which each term is the sum of the two preceding terms.
Alt kotlin

Top comments (1)

Collapse
 
madza profile image
Madza • Edited

const fib=n=>[...Array(n)].reduce((acc,val,i)=>acc.concat(i>1?acc[i-1]+acc[i-2]:i),[])