The Tribonacci sequence is defined as , , , and for .
Given , compute . This is like Fibonacci but with three terms instead of two.
Hint: use dynamic programming with time and space by tracking only the last three values.
LeetCode 1137
The Tribonacci sequence is defined as , , , and for .
Given , compute . This is like Fibonacci but with three terms instead of two.
Hint: use dynamic programming with time and space by tracking only the last three values.