Design an in-memory key-value store that supports time-based lookups.
Implement a class (or module) with the following methods:
set(key, value, timestamp)
value
for string
key
at integer
timestamp
.
get(key, timestamp)
key
for the
largest stored timestamp t such that t <= timestamp
.
null
, but be consistent).
set()
calls on the same key are non-decreasing.
get()
queries.
set("room", "A", 10)
set("room", "B", 20)
get("room", 5) -> ""
get("room", 10) -> "A"
get("room", 15) -> "A"
get("room", 20) -> "B"
get("room", 25) -> "B"