$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · medium · #270

What goes in both blanks?

from functools import ____

@____(maxsize=None)
def fib(n):
    return n if n < 2 else fib(n-1) + fib(n-2)

Answer: lru_cache (also accepted: lru_cache, lru_cache())

Memoising turns the exponential recursion into linear work.
Play Problem Solving ▸