Implement decorator factory `lru_cache(maxsize)` callable as `@lru_cache(maxsize=N)`. Evict least-recently used when capacity is exceeded. `maxsize=None` → unbounded.
Constraints
Functions accept hashable positional args only.
Example
@lru_cache(maxsize=2)
def ping(x): return x
ping(1); ping(2); ping(3) # 1 may be evicted
50 points
~40 min
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints
OrderedDict + move_to_end(..., True) models recency without timestamps.
Python 3
All tests passed!
Test Results
Press Ctrl+Enter or click Run Tests to execute your code.
SponsoredReserved space — layout preview until AdSense is connected