Problem · Design
Durable String Key-Value Store
Problem statement
Implement a durable string key-value store by processing an ordered array of commands. The store starts with an empty in-memory map and an empty durable log file.
The problem statement continues
ProExamples
Example 1
operations = [["PUT","user","alice"],["GET","user"],["PUT","user","bob"],["RECOVER"],["GET","user"],["SERIALIZE"]]return = ["OK","VALUE:alice","OK","OK","VALUE:bob","4:user3:bob"]The second PUT overwrites the in-memory value and appends a later log record. Recovery replays both records, so the later value bob wins. The final snapshot contains the one current pair.
FastPrep Pro
Reported in 1 OpenAI interview this weekUnlock this recently reported problem
FastPrep Pro gives you full access to interview problems reported within the last week.
- Full problem statement and constraints
- 2 more worked examples, explained
- Guided hints and editorial
- Run your code on real test cases
$9/month
Pro subscription, billed yearly — or $19 month-to-month. Cancel anytime.
Free plan — 2 of 2 free unlocks used this week