Design a Key-Value Store with Versioning

Last updated: October 30, 2025

Quick Overview

Implement a key-value store that supports versioned reads. Each write creates a new version, and reads can query the value at any historical timestamp. Support get, put, and get_at_timestamp operations.

Intuit
Coding & Algorithms
Software Engineer
Intuit
October 30, 2025
Software Engineer
Craft Demonstration
Coding & Algorithms
Hard

13

7

2,581 solved


Implement a key-value store that supports versioned reads. Each write creates a new version, and reads can query the value at any historical timestamp. Support get, put, and get_at_timestamp operations.

Appears in Craft Demos and senior-level phone screens. Directly relevant to Intuit's financial systems where audit trails require querying historical state of any record.

What the Interviewer Expects
  • Implement efficient versioned storage with O(log n) historical reads via binary search
  • Handle edge cases like querying timestamps before the first write
  • Design a clean API that separates current and historical access patterns
  • Consider memory management for long-lived keys with many versions
  • Write comprehensive tests covering version boundaries
Key Topics to Cover
Versioned Data
Binary Search
Key-Value Store
Audit Trail
Time-Series Data
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 add a compact/gc operation to reclaim old versions?
  • How would you implement range queries across versions?
  • What changes would you make to support transactions across multiple keys?
  • How would you distribute this across multiple machines?
Sharpen Your Skills on Codemia

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

Practice DSA Problems
Sample Answer
Problem Analysis

This problem requires us to implement a key-value store that supports versioning, allowing us to read values at specific historical timestamps. The key challenge is efficiently managing the versions o...

Approach
  1. Data Structure: Use a dictionary to map keys to lists of tuples, where each tuple contains a timestamp and the corresponding value. This allows us to keep track of all versions for each key.

...


Submit Your Answer
Markdown supported

Related Questions