Design an in-memory key-value store using maps
LinkedInSoftware Engineer · OnsiteLast updated
This question evaluates skills in in-memory data modeling, concurrent access control, time-complexity reasoning for expected O(1) operations, and storage engine considerations such as durability, compaction, and TTL when restricting indexing to map/dictionary primitives.
Design a low-level key-value store library (like an embedded storage engine) under an interview constraint: you may use only map/dictionary-like data structures (plus primitive types / arrays if needed) for your in-memory indexing.
Core API
put(key, value)get(key) -> value | nulldelete(key)
Required properties
- Expected
O(1)average time forget/put/delete - Safe under concurrent access (multiple threads)
- Optional but good to discuss: durability (crash recovery), compaction, TTL/expiration
Deliverable
Explain your design choices (data model, concurrency strategy, persistence approach if any), and how you would test it.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.