Bloomberg OA 2023 | Time Based Key Value Store | Java Solution | Binary Search Design

Question · Posted Jun 2026

Problem Statement Design a time-based key-value data structure that can store multiple values for the same key at different timestamps. Implement the TimeMap class: Functions set(String key, String value, int timestamp) Stores the key-value pair along with the given timestamp. get(String key, int timestamp) Returns the value associated with the largest timestamp less than or equal to the given timestamp. If no such timestamp exists, return an empty string "". Example Input set("foo","bar",1) get("foo",1) set("foo","bar2",4) get("foo",4) get("foo",5) Output bar bar2 ...

The full answer & interview discussion are available to premium members.

Log in Create a free account