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.

Example:

n=10

queries=[[1,5,3],[4,8,7],[6,9,1]]
Go to problem statement

## Explanation Video:

Youtube Channel partner: CodingCart

Mentor: Satyendra Jaiswal

Langauge: Python

## Source Code: for `Array Manipulation`

function

```
n,m=map(int,input().split())
a=[0]*(n+1)
m_sum=temp=0
for _ in range(m):
f,l,val=[int(n) for n in input().split()]
a[f-1]+=val
if l<=n:
a[l]-=val
for i in a:
temp+=i
if m_sum
```

coming soon…

coming soon…

**Like this article?** Follow us on Facebook and LinkedIn. You can also subscribe to our Youtube Channel.

This post is in partner with CodingCart.