Memoization
• 31 words • 1 min • updated
How to bootstrap a top-down dynamic programming (DP) problem in Python:
python
from functools import cache
class Solution:
def doProblem(self, input: List[int]) -> int:
@cache
def solve():
pass
return solve(0)Previously. ∎