Nth Fibonacci

Jack
Jan 11, 2021

Create a function that takes in one argument, n, and returns the n-th fibonacci number.

Recursion

Recursion could be quite useful in this particular problem. We can call fib(n-1) and fib(n — 2) to calculate the n-th Fibonacci. Don’t forget to set base cases so that this recursion doesn’t run forever.

--

--

Jack

Magician, Mathematician, and Software Engineer