← ALL NOTES
Math

1137. N-th Tribonacci Number

The Tribonacci sequence: T0=0, T1=1, T2=1, and T_n = T_{n-1} + T_{n-2} + T_{n-3}. Return T_n. It's Fibonacci with a three-term recurrence, so the same "keep only the last few values and roll forward"…

Loading…