Use @lru_cache(maxsize=128) to memoize a recursive factorial function
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
Problem
Use @lru_cache(maxsize=128) to memoize a recursive factorial function. Call factorial(10) twice. Print the result, whether both calls returned the same value, and the cache hits and misses from cache_info().
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.