Segment Tree Range Minimum (OOP)

Programming Interview Hard 8 views
Back to Questions

Problem Description

You get {x}. Build SegmentTree class with update(i,x) and query(l,r) returning minimum. Output query answers.

Input Format

First line n q. Second line n integers. Next q lines: 1 i x (update) or 2 l r (min).

Output Format

Outputs for type 2.

Sample Test Case

Input:
5 5 5 2 7 3 9 2 2 4 1 3 1 2 1 3 1 5 0 2 4 5
Output:
2 1 0

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next