Memoisasi Python
def momoize(func):
memoized = {}
def inner(number):
if number not in memoized:
memoized[number] = func(number)
return memoized[number]
return inner
@momoize
def generateFactorial(number):
if number == 1:
return 1
else:
return number * generateFactorial(number - 1)
Xerothermic Xenomorph