N-th Tribonacci Number Problem

N-th Tribonacci Number Problem — ExecCode Medium DSA Practice

Solve the N-th Tribonacci Number problem on ExecCode. Free online medium DSA practice in DP. Write and run code in Java, C++, Python — no signup required to run.

Problem description

The Tribonacci sequence T(n) is defined as follows: T(0) = 0, T(1) = 1, T(2) = 1 T(n) = T(n - 1) + T(n - 2) + T(n - 3) for n >= 3. Returns the n-th value of this sequence.

Examples

Input n = 3; Output 2. Input n = 4; Output 4. Input n = 5; Output 7

Constraints

0 <= n <= 37 Answer is guaranteed to fit within a 32-bit integer

Practice N-th Tribonacci Number free on ExecCode. Browse DSA problems, topic map, and placement guides.