PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Microsoft

Design a Versioned Key-Value Store

Last updated: Apr 16, 2026

Quick Overview

This question evaluates understanding of time-versioned data structures, temporal indexing, and efficient lookup strategies for storing and retrieving values by key across timestamps.

  • medium
  • Microsoft
  • Coding & Algorithms
  • Software Engineer

Design a Versioned Key-Value Store

Company: Microsoft

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Implement a data structure for storing values by key over time. The structure should support these operations: - `put(key, value, timestamp)`: Store the string `value` for the string `key` at the given integer `timestamp`. - `get(key, timestamp)`: Return the value associated with `key` at the greatest timestamp less than or equal to `timestamp`. If there is no stored value for `key` at or before the requested time, return an empty string. Assumptions: - `key` and `value` are non-empty strings. - `timestamp` is a positive integer. - Calls to `put` are given in strictly increasing timestamp order. Example: - `put("foo", "bar", 1)` - `get("foo", 1)` returns `"bar"` - `get("foo", 3)` returns `"bar"` - `put("foo", "baz", 4)` - `get("foo", 4)` returns `"baz"` - `get("foo", 5)` returns `"baz"`

Quick Answer: This question evaluates understanding of time-versioned data structures, temporal indexing, and efficient lookup strategies for storing and retrieving values by key across timestamps.

Related Interview Questions

  • Return Top K Open Businesses - Microsoft (hard)
  • Implement Memory Allocation and In-Memory Records - Microsoft (medium)
  • Implement K-Means and Detect Divisible Subarrays - Microsoft (medium)
  • Sort Three Categories In Place - Microsoft (medium)
  • Retain Top K Elements - Microsoft (medium)
Microsoft logo
Microsoft
Jan 26, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
1
0
Loading...

Implement a data structure for storing values by key over time.

The structure should support these operations:

  • put(key, value, timestamp) : Store the string value for the string key at the given integer timestamp .
  • get(key, timestamp) : Return the value associated with key at the greatest timestamp less than or equal to timestamp .

If there is no stored value for key at or before the requested time, return an empty string.

Assumptions:

  • key and value are non-empty strings.
  • timestamp is a positive integer.
  • Calls to put are given in strictly increasing timestamp order.

Example:

  • put("foo", "bar", 1)
  • get("foo", 1) returns "bar"
  • get("foo", 3) returns "bar"
  • put("foo", "baz", 4)
  • get("foo", 4) returns "baz"
  • get("foo", 5) returns "baz"

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Microsoft•More Software Engineer•Microsoft Software Engineer•Microsoft Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.