Back to problems

Time-Keyed Key-Value Store (set / get-before-timestamp)

Algorithm · Citadel · Medium

Requirements Create a class named TimeMap that exposes these two methods: set(key, val, timestamp) records val for key at timestamp. For any given key, calls to set arrive with strictly increasing timestamps. get(key, timestamp) retrieves the value whose timestamp is the greatest one less than or equal to the requested time. When there is no value at the exact query time, use the most recent applicable value according to the interviewer's clarification. Clarify the expected…

Checking your access…