FunctionRacerProblemsRace

Fibonacci Number

BeginnerDynamic programmingPython, JavaScript, TypeScript, Java, C++

The Fibonacci numbers start with F(0) = 0 and F(1) = 1, and every later one is the sum of the two before it. Return F(n).

Example 1

n 6
returns 8

0, 1, 1, 2, 3, 5, 8: F(6) = 8.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Dynamic programming problems