← All problems

Time Based Key-Value Store

Medium searchinghash mapsdesign LeetCode ↗
set(key, value, timestamp); get(key, timestamp) returns the latest value at or before timestamp.

Hints (0/3 revealed)

Log in to reveal hints progressively.

Complexity

Time O(log n) get, Space O(n)

Common pitfalls

  • Linear scan per get
  • Leftmost vs rightmost binary search confusion

Your solution

Log in to save your code and track progress.