Solution Review: Fibonacci Numbers
Let’s take a detailed look at the previous challenge’s solution.
We'll cover the following
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 and so on.
Let’s look at the visual illustration for this problem.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.