Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each the array element between two given indices, inclusive. Once all operations have been performed, return the maximum value in the array.
Queries are interpreted as follows:
Add the values of between the indices and inclusive:
The largest value is after all operations are performed.
Complete the function arrayManipulation in the editor below.
arrayManipulation has the following parameters:
int n - the number of elements in the array
int queries[q] - a two dimensional array of queries where each queries[i] contains three integers, a, b, and k.
int - the maximum value in the resultant array
The first line contains two space-separated integers and , the size of the array and the number of operations.
Each of the next lines contains three space-separated integers , and , the left index, right index and summand.
1 2 100
2 5 100
3 4 100
After the first update the list is 100 100 0 0 0.
After the second update list is 100 200 100 100 100.
After the third update list is 100 200 200 200 100.