Fibonacci Number
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
0 <= n <= 40
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Dynamic programming problems
- Frog Across the StonesBeginner
- Hop One or ThreeBeginner
- N-th Tribonacci NumberBeginner
- Paving With Colored SlabsBeginner
- Pell NumbersBeginner
- Savings With InterestBeginner
- Stacked CansBeginner
- Sum of the Last kBeginner