All challenges
easydp 10 XP per passing test

Nth Fibonacci Number

Problem

Given a non-negative integer n, return the nth Fibonacci number. The Fibonacci sequence is defined recursively as follows: the first two numbers are 0 and 1, and each subsequent number is the sum of the previous two. For example, the sequence starts as: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...
(run your code to see output)
Advertisement
Sponsored