Find the bugs in a dictionary memoization cache under concurrency

0
Remix

A slow function is wrapped by a module-level dictionary that stores its results: look up the key, otherwise compute and store. You are shown the code and asked what breaks in production once many threads (or async tasks) call it.

Cover duplicate work when two callers miss at once, races on the dictionary, memory that grows without bound, missing eviction or expiry, and how you would rewrite it to be safe and bounded.

MercorTechnical phone screenLast asked Sep 2026
No answer yet. Write the first one; the best answer gets endorsed.