981. Time Based Key-Value Store

Practice Time Based Key-Value Store for free on NudgeCode: Medium, Binary Search pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Design a key-value store that keeps every version of a value, each tagged with a timestamp.

Each test is a list of operations and their arguments; the expected output lists what each call returns (null for the constructor and for calls that return nothing).

Example

["TimeMap","set","get","get","set","get","get"]
[[],["foo","bar",1],["foo",1],["foo",3],["foo","bar2",4],["foo",4],["foo",5]]
->  [null,null,"bar","bar",null,"bar2","bar2"]

Constraints