# Solution 1 hash map + map

Assuming n is the number of set operations, and m is the number os get operations

* Time Comlpexity:
  * Set: O(1) single operation, and total O(n) Note: assuming timestamps are only increasing, If not, it's O(n log n)
  * Get: O(log n) for a single operation, and total O(m log n)
* Space Comlpexity: O(n)

由于添加的 timestamp 是递增的，内层也可以用数组 + 二分查找


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://851958789.gitbook.io/notes/0981_time_based_key-value_store/slt.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
