N-th Tribonacci Number
The sequence T starts with T(0) = 0, T(1) = 1, T(2) = 1, and each later term is the sum of the three terms before it. Return T(n).
Example 1
n 4
returns 4
T(3) = 0+1+1 = 2, T(4) = 1+1+2 = 4.
Constraints
0 <= n <= 37
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Dynamic programming problems
- Paving With Colored SlabsBeginner
- Pell NumbersBeginner
- Savings With InterestBeginner
- Stacked CansBeginner
- Sum of the Last kBeginner
- Take One, Two or ThreeBeginner
- Three Button CalculatorBeginner
- Broken StairsEasy