Versioned Settings Store With Point-in-Time Reads

Last updated: November 29, 2026

Quick Overview

Build a key-value store for application configuration where set(key, value, timestamp) records a new version and get(key, timestamp) returns the value that was current at that time, or an empty string if none existed yet.

Microsoft
Coding & Algorithms
Software Engineer
Microsoft
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Medium

0

0

0 solved


Build a key-value store for application configuration where set(key, value, timestamp) records a new version and get(key, timestamp) returns the value that was current at that time, or an empty string if none existed yet.

A Microsoft phone screen question in the spirit of Azure App Configuration, where engineers need to know which feature flag value a service saw at the moment of an incident. The interviewer checks that you exploit monotonic timestamps for binary search and handle reads before the first write.

What the Interviewer Expects
  • Store per-key lists of timestamps and values
  • Use binary search to find the latest timestamp at or before the query
  • Return the empty result for queries before the first version
  • Note the assumption that timestamps per key are increasing
  • Discuss what changes if writes arrive out of order
Key Topics to Cover
binary search
hash map
versioning
configuration management
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you support deleting a key at a point in time?
  • How would you store this durably and query it from many regions?
  • What if writes for a key can arrive out of order?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

set(key, value, ts) records that key became value at time ts. Timestamps for a given key arrive in strictly increasing order (I would confirm this, as it is what makes appending valid). `get(k...

High-Level Design

Per key, keep two parallel lists: timestamps and values. Because writes are monotonic, appending keeps the timestamp list sorted, so a read is a binary search. bisect_right(times, ts) returns the co...


Submit Your Answer
Markdown supported