• + 0 comments

    Python code, All Test Case Passed

    def arrayManipulation(n, queries):
        arr = [0]*(n+1)
        for (start, end, value) in queries:
            arr[start-1] += value
            arr[end] -= value
    
        itsum = 0
        mnum = 0
        for i in range(n):
            itsum += arr[i]
            if mnum < itsum:
                mnum = itsum
             
        return mnum