Time based key value store

Write codeMedium25 minGoogle style

Your task

Design a time-based key-value store. Process ops: ['set', key, value, timestamp] stores the value for key at the given timestamp (timestamps for a given key are strictly increasing in call order), and ['get', key, timestamp] returns the value whose stored timestamp is the largest one <= the query timestamp, or the empty string '' if none exists. Return the list of get results, in order.

Examples

time_map(ops: list[list]) -> list[str]
Example 1
Inputtime_map([["set", "foo", "bar", 1], ["get", "foo", 1], ["get", "foo", 3], ["set", "foo", "bar2", 4], ["get", "foo", 4], ["get", "foo", 5]])
Output["bar", "bar", "bar2", "bar2"]