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 451c97d commit 15b1a67Copy full SHA for 15b1a67
maths/fibonacci.py
@@ -86,6 +86,8 @@ def fib_iterative(n: int) -> list[int]:
86
for _ in range(n - 1):
87
fib.append(fib[-1] + fib[-2])
88
return fib
89
+
90
91
def fib_recursive(n: int) -> list[int]:
92
"""
93
Calculate the first n (0-indexed) Fibonacci numbers using recursion.
@@ -108,6 +110,7 @@ def fib_recursive(n: int) -> list[int]:
108
110
...
109
111
ValueError: n is negative
112
113
114
def fib_recursive_term(i: int) -> int:
115
if i < 0:
116
raise ValueError("n is negative")
0 commit comments