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 8b8fba3 commit bc74c0eCopy full SHA for bc74c0e
dynamic_programming/factorial.py
@@ -1,4 +1,16 @@
1
+#Factorial is the product of all positive integers less than or equal to a given positive integer
2
+#and denoted by that integer and an exclamation point.
3
+#For example, factorial seven is written 7!, meaning 1 × 2 × 3 × 4 × 5 × 6 × 7.
4
+#Factorial zero is defined as equal to 1.
5
+
6
# Factorial of a number using memoization
7
+#If n = 0, return 1
8
+#Otherwise if n is in the memo, return the memo's value for n
9
+#Otherwise,
10
+#Calculate (n - 1)! x n
11
+#Store result in the memo
12
+#Return result
13
14
15
from functools import lru_cache
16
0 commit comments