thiagowfx's avatar

Β¬ just serendipity πŸ€ (not just serendipity)

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.