1137. N-th Tribonacci Number
class Solution: def tribonacci(self, n: int) -> int: a, b, c = 0, 1, 1 for _ in range(n-2): a, b, c = b, c, a+b+c return [c, 0][n == 0]
O(N)
O(1)