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 b9913e3 commit 73c918eCopy full SHA for 73c918e
fibonacci/python/Fibonacci-with-Memoization.py
@@ -4,7 +4,7 @@
4
5
6
# Array for saving calculated ones
7
-fib_mem = [0 for i in range(100000)]
+fib_mem = [0]*100000
8
fib_mem[0] = 0
9
fib_mem[1] = 1
10
@@ -29,10 +29,13 @@ def main():
29
30
# Take input
31
n = int(input("Enter the number of terms: \n"))
32
+
33
+ # setting the values of array
34
+ temp = fibonacci(n)
35
36
# loop an print the series
37
for i in range(n):
- print(fibonacci(i))
38
+ print(fib_mem[i])
39
40
# Run the script
41
main()
0 commit comments