For this question we will give you an array and a series of queries and updates.
Each update can change 1 particular value in the array and each query will give you an interval where you have to return the maximum value on the interval.
Each query or update will be a list of 3
elements.
The first element is a number denoting a query or update operation, 1
will denote a query and 2
an update operation.
If the number is a 1
the next 2 numbers will denote the interval that is to be queried in the 0-indexed array.
If the number is a 2
the next 2 numbers will denote the index i
and value v
in that order which means that index i
in the array should be updated to v
.
This is a companion discussion topic for the original entry at https://algo.monster/problems/range_max/