 All Problems
N-th Tribonacci Number
easy
dynamic programming
math
amazon
google

The Tribonacci sequence: T0=0, T1=1, T2=1, Tn=T(n-1)+T(n-2)+T(n-3) for n >= 3. Given n, return Tn.

Example 1:

Input: 4
Output: 4

Example 2:

Input: 25
Output: 1389537

Constraints: 0 <= n <= 37

Input format: Single integer n.

Output format: Tn.

Run to check your code against the sample cases, or submit to run every case