Range minimum queries

Write codeMedium25 minCitadel style

Your task

Given a static integer array arr and a list of inclusive range queries [l, r] (0-indexed, l <= r), return the minimum element of each range. Build a segment tree so each query is O(log n). Values may be negative. Return the list of minima in query order.

Examples

range_min_queries(arr: list[int], queries: list[list[int]]) -> list[int]
Example 1
Inputrange_min_queries([2, 5, 1, 4, 9, 3], [[0, 5], [1, 3], [4, 4], [3, 5]])
Output[1, 1, 9, 3]