From b9adc9a8727c7ce87b2462cc1fbc84676f128d58 Mon Sep 17 00:00:00 2001 From: Won Joon Thomas Choi <113500771+724thomas@users.noreply.github.com> Date: Wed, 23 Sep 2026 23:32:59 +0900 Subject: [PATCH] Create 1137. N-th Tribonacci Number.py --- .../1137. N-th Tribonacci Number.py" | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 "leetcode3/\354\265\234\354\233\220\354\244\200/1137. N-th Tribonacci Number.py" diff --git "a/leetcode3/\354\265\234\354\233\220\354\244\200/1137. N-th Tribonacci Number.py" "b/leetcode3/\354\265\234\354\233\220\354\244\200/1137. N-th Tribonacci Number.py" new file mode 100644 index 00000000..97749977 --- /dev/null +++ "b/leetcode3/\354\265\234\354\233\220\354\244\200/1137. N-th Tribonacci Number.py" @@ -0,0 +1,17 @@ +class Solution: + def tribonacci(self, n: int) -> int: + if n == 0: + return 0 + if n == 1 or n == 2: + return 1 + a = 0 + b = 1 + c = 1 + + for i in range(n-2): + temp = a + b + c + a = b + b = c + c = temp + + return c