We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c63accf commit eec6e98Copy full SHA for eec6e98
Dynamic Programming/Tribonacci Number/main.py
@@ -0,0 +1,9 @@
1
+T = {0:0, 1:1, 2:1}
2
+
3
+def tribonacci(n):
4
+ if n not in T:
5
+ T[n] = self.tribonacci(n - 3) + self.tribonacci(n - 2) + self.tribonacci(n - 1)
6
+ return T[n]
7
8
+N = int(input())
9
+print(tribonacci(N))
0 commit comments