Code Room
CodingMediumcod-g551
Subject Segment treeLevel Mid–Senior~30 minCommon in Algorithms & data structures interviewsIndustries Software development, Technology

Question

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.

Implement
range_max_point_update(arr: list[int], ops: list) → list[int]
Examples
in[[1,3,2,7,9,11],[["query",0,3],["set",2,15],["query",0,3],["query",4,5]]]out[7,15,11]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.