tribonacci sequence using dynamic programming given a number return first n tribonacci numbers tribonacci5 0 0 1 1 2 tribonacci8 0 0 1 1 2 4 7 13 tribonacci sequence using dynamic programming given a number return first n tribonacci numbers tribonacci 5 0 0 1 1 2 tribonacci 8 0 0 1 1 2 4 7 13
def tribonacci(num: int) -> list[int]:
    
    dp = [0] * num
    dp[2] = 1

    for i in range(3, num):
        dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3]

    return dp


if __name__ == "__main__":
    import doctest

    doctest.testmod()