Time-Based Key-Value Store
Medium · Phone screen · Onsite · Full-time
Design a key-value store where each key can hold multiple values at different timestamps. Get returns the value with the largest timestamp that doesn't exceed the query timestamp. I used a hash map where each key maps to a sorted list of timestamp-value pairs, then binary searched on get. The interviewer asked about memory efficiency and whether I'd change the design for write-heavy versus read-heavy workloads.
