T(0)=0, T(1)=1, T(2)=1, T(n+3)=T(n)+T(n+1)+T(n+2). Given n, return T(n).
Iterative DP with three variables.
- Base cases: T(0)=0, T(1)=1, T(2)=1.
- For i from 3 to n: T = T0+T1+T2; shift variables.
- Time Complexity: O(N)
- Space Complexity: O(1)
T(0)=0, T(1)=1, T(2)=1, T(n+3)=T(n)+T(n+1)+T(n+2). Given n, return T(n).
Iterative DP with three variables.