dynamic-programming

#cs/algorithms#cs

Dynamic Programming

DP solves problems by breaking them into overlapping subproblems and memoising results.

@functools.lru_cache(None)
def fib(n):
    return n if n <= 1 else fib(n-1) + fib(n-2)

See Recursion · Algorithms Overview · CS Concepts Hub.