1
2
3
4
5
6
|
class Solution:
def tribonacci(self, n: int) -> int:
answer = [0, 1, 1]
for i in range(2, n):
answer.append(answer[i] + answer[i - 1] + answer[i - 2])
return answer[n]
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 2855. Minimum Right Shifts to Sort the Array (0) | 2024.04.26 |
---|---|
leetcode 3074. Apple Redistribution into Boxes (0) | 2024.04.25 |
leetcode 3065. Minimum Operations to Exceed Threshold Value I (0) | 2024.04.24 |
leetcode 3069. Distribute Elements Into Two Arrays I (0) | 2024.04.24 |
leetcode 3079. Find the Sum of Encrypted Integers (0) | 2024.04.24 |
댓글