DeepOffer

Implement an LRU cache with O(1) get/put, then add TTL.

ML CodingReported interview question
Reported in public interview compilations — OpenAI, xAI, Alibaba

Combine a hash map with a doubly linked recency list for O(1) get and put. Move hits to the front, evict from the tail, and integrate TTL with expiry checks or a heap; concurrency needs a clear lock or sharding policy.

Test empty input, one-element input, duplicates, boundary indices, invalid states, and the largest allowed size; state time and space complexity.

Common follow-up questions

Practice this question with an AI interviewer

Get asked follow-ups live, then receive a scored report — like a real MLE interview loop.

Start AI mock interview