What is the output of the following Python code snippet?
from functools import lru_cache
@lru_cache(None)
def fib(n):
return n if n
Correct answer
C. 55
5 views
C. 55
5 views
lru_cache memoizes recursive calls and makes Fibonacci fast.
Asked in: Python Interview Advanced
https://docs.python.org/3/library/index.htmlNot sure why the answer is C? Ask here and get an explanation.