Ordered index range query

Write codeMedium25 minSnowflake and Oracle style

Your task

Model a simple ordered index (like a B-tree leaf level) over integer keys. You are given a list of operations. Each op is either ["insert", key] which adds key to the index (duplicates are ignored, the index is a set of keys), or ["range", lo, hi] which queries all keys k with lo <= k <= hi. Return a list with one sorted ascending list of keys for each "range" op, in the order the range ops appear. Keys are integers; there are at most 10^4 ops.

Examples

ordered_index(ops: list[list]) -> list[list[int]]
Example 1
Inputordered_index([["insert", 5], ["insert", 1], ["insert", 3], ["range", 2, 5]])
Output[[3, 5]]