Python data engineering interview problem. Difficulty: intermediate. Pattern: Recursion. About 15 minutes. Part of the Pro drill bank.
An expensive lookup (here, a Fibonacci-style recurrence) is called with the same n many times. Memoization should make repeated calls cheap.
Return the nth Fibonacci-like value using memoization.
Input: fib_memo(0) Output: 0 This input follows the stated rules and produces this output.
Topics: lakebench, python, decorators.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Write a decorator that caches a function's results by its arguments.
Return the nth Fibonacci-like value using memoization.