Write a function fibonacci(n) that returns an array with the first n Fibonacci numbers.
0 and 1. Every next number is the sum of the two numbers before it: 0, 1, 1, 2, 3, 5, 8, 13, ...n is an integer from 0 to 50. For 0 return an empty array [].Then write a second function fibonacciBetween(min, max). It returns every Fibonacci number x with min <= x <= max, in the order of the sequence.
1 is in the sequence twice, keep both: fibonacciBetween(1, 1) returns [1, 1].[].min and max are integers, 0 <= min <= max <= 1000000.fibonacci(7)Returns [ 0, 1, 1, 2, 3, 5, 8 ]
fibonacci(1)Returns [ 0 ]
fibonacciBetween(50, 100)Returns [ 55, 89 ]
Asked at Accion Labs · Source
fibonacci(7)[
0, 1, 1, 2,
3, 5, 8
]fibonacci(1)[ 0 ]fibonacci(0)[]Hidden tests run on Submit.