• + 0 comments

    Python Code

    #### I Hope it Helps

    def arrayManipulation(n, queries):
        a = [0]*n
        maxx = 0
        x = 0
        for init, final, k in queries:
            if(k == 0):
                continue
            a[init-1] += k
            if(final < n):
                a[final] -= k
        for element in a:
            x += element
            if(maxx < x):
                maxx = x
        return maxx