Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 778 Bytes

README.md

File metadata and controls

16 lines (12 loc) · 778 Bytes

Fibonacci Sequence

One of the most popular coding challenges is to write an algorithm to return the n-th element in the Fibonacci sequence. Officially, the Fibonacci sequence is the integer sequence defined by the recurrence relation: F(n) = F(n-1) + F(n-2), where F(0) = 0 and F(1) = 1. For those of us who aren't math whizzes, the nth Fibonacci number is the sum of the prior two Fibonacci numbers.

Below are the first few values of the sequence:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...

Your challenge today is to write an algorithm that, given a number n, return the n-th Fibonacci Number. Keep in mind that the first two numbers in the fibonacci sequence are always [0,1]

Examples:

find_fibonacci(3) -> 2
find_fibonacci(7) -> 13