Segment tree range max

Write codeMedium30 minCitadel style

Your task

Build an iterative (bottom-up) segment tree over an integer array supporting point updates and range-max queries. Process operations: ["set", pos, v] sets arr[pos] = v; ["query", l, r] returns the maximum over the inclusive range [l, r]. Return the list of query answers in order. Use the array-backed iterative segment tree (size padded to a power of two) so each operation is O(log n) with low constant factors.

Examples

range_max_point_update(arr: list[int], ops: list) -> list[int]
Example 1
Inputrange_max_point_update([1, 3, 2, 7, 9, 11], [["query", 0, 3], ["set", 2, 15], ["query", 0, 3], ["query", 4, 5]])
Output[7, 15, 11]