Maximum subarray with updates
Your task
Maintain an integer array under point assignments and answer maximum-subarray queries. Process operations: ["set", i, v] assigns arr[i] = v, and ["max"] returns the maximum sum of any NON-EMPTY contiguous subarray of the current array. Return the list of answers to "max" operations in order. Each operation must run in O(log n).
Examples
max_subarray_with_updates(arr: list[int], ops: list[list]) -> list[int]Example 1
Input
max_subarray_with_updates([1, -2, 3, 4, -1], [["max"], ["set", 1, 5], ["max"], ["set", 3, -10], ["max"]])Output
[7, 13, 9]