Quant Memo
Coding/●●●●●

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 that key had value at time timestamp;
  • get(key, timestamp), return the value that was set for key at 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 O(1)O(1) and get in O(logn)O(\log n).

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions