• + 0 comments

    It took me a minute to understand your approach. Basically your solution takes into account the fact the sections of the array where queries make the most additions will influence the output the most. There is no need to add a query to all elements in its range. It just needs to be added once at the start of its range. The array maximum value can be found among the elements where most of the queries made an addition or at an element with the largest added value.