Implement In-Memory Key-Value Store With Expiration
Design and implement an in-memory key-value store that supports basic operations (get, put, delete) with automatic key expiration based on TTL (time-to-live). The implementation should efficiently handle expired key cleanup and provide O(1) average time complexity for core operations.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early July, 2026
Late June, 2026
Regular cache with TTL, when asked interviewer said put in O(logn) is enough
Late February, 2026
Problem starts with a basic statement of designing a cache where an entry has an expiry. As a candidate, you are expected to clarify requirements (like capacity, datatype, single/multi threaded env, eviction policy..) Code the basic version, complie and test with some examples. Follow ups after basic functionality: - Changes if its a distributed system? - What eviction policy to use?
Hello Interview Premium
Your account is free and you can post anonymously if you choose.