We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
For anybody still confused, just think of the array like voltage vs. time and the intervals are a pair of commands that tell when the signal goes up/down.
So query (p q sum) means:
raise voltage by sum starting at time p
lower voltage by sum after time q
The question is then asking, what's the peak voltage?
The auxillary array is the net change in voltage at every point in time. So we can find peak voltage by examining every point in time while summing up all of the change of voltage commands encountered thus far.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Array Manipulation
You are viewing a single comment's thread. Return to all comments →
For anybody still confused, just think of the array like voltage vs. time and the intervals are a pair of commands that tell when the signal goes up/down.
So query (p q sum) means:
The question is then asking, what's the peak voltage?
The auxillary array is the net change in voltage at every point in time. So we can find peak voltage by examining every point in time while summing up all of the change of voltage commands encountered thus far.