LRU Cache with TTL Support
Implement an LRU Cache using a doubly linked list and hash map, then extend it to support TTL (Time-To-Live) expiration on cache entries.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early October, 2026
Phase 1: Codebase Comprehension & Debugging (First 5–10 Minutes) Setup: I was provided with an existing, multi-file codebase implementing an LRU Cache. Constraint: The interviewer explicitly instructed not to use AI tools during this initial phase. Task: Walk through the existing repository, trace how the data structures (e.g., doubly linked list + hash map) interacted, identify any existing issues or edge cases, and explain the end-to-end flow to the interviewer before writing any new code. Phase 2: Feature Implementation – Adding TTL (Time-To-Live) Support Delivery: Once I had explained the codebase thoroughly, the interviewer verbally described the extension requirements rather than pasting a written prompt into the editor. Task: Extend the existing LRU Cache implementation to support TTL (Time-To-Live) expiration on cache entries and some follow-up questions around the output generated by AI is valid.
Your account is free and you can post anonymously if you choose.