Time-based key-value store
Asked at Jump Trading
Design a store (think: the last-known reference price of each symbol over a trading day) supporting:
set(key, value, timestamp), record thatkeyhadvalueat timetimestamp;get(key, timestamp), return the value that was set forkeyat the greatest timestamp less than or equal to the query time, or""if none exists.
You may assume set is always called with strictly increasing timestamps for a given key.
Make set run in and get in .
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.