• + 3 comments

    Python 3 more clear code

    def arrayManipulation(n, queries):
        
        my_array = [0] * (n+1)
        count = 0
        temp = 0
        for first,last,value in queries:
            
            my_array[first-1] += value
            my_array[last] -= value
        
        for item in my_array:
            count += item
            if count > temp:
                temp = count
           
        return temp