Solution Review: Fibonacci Numbers

Let’s take a detailed look at the previous challenge’s solution.

Solution

A Fibonacci number is calculated by adding the previous two Fibonacci numbers. At the start, we assume the first two numbers are 1 and 1. So, its formula is f(n) = f(n-1) + f(n-2).

Example

For example, the Fibonacci series is 1,1,2,3,5,8,1, 1, 2, 3, 5, 8, and so on.

Let’s look at the visual illustration for this problem.

Get hands-on with 1400+ tech skills courses.