Challenge: Finding Fibonacci Numbers with Array

This lesson brings you a challenge to solve.

We'll cover the following

Problem statement

In the last chapter, we saw a recursive solution for calculating Fibonacci numbers. However, Fibonacci numbers can also be calculated in an iterative way, using a simple array. Do this for the first 10 Fibonacci numbers (using an array) and then return the array.

Output

An array

Sample output

[1 1 2 3 5 8 13 21 34 55]

Try to implement the function below. Feel free to view the solution, after giving some shots. Good Luck!

Get hands-on with 1400+ tech skills courses.