You are viewing a single comment's thread. Return to all comments →
Guys, if you look for a clear understanding of the solution, I read a pretty clear comment down the road that clarified my mind.
Basically, when you add value from a to b you just need to know that it goes up from k and goes down of k after.
What this algo does is to register the slopes only, so we just need 2 entry, with O(1) complexity.
We just need to know that we are upping from k at the beginning and decreasing at the end.
Finally, the maximum would be...
The addition of all the slopes, that is why it's max(sum) of the tables, because the tables itself registers the slopes
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 →
Guys, if you look for a clear understanding of the solution, I read a pretty clear comment down the road that clarified my mind.
Basically, when you add value from a to b you just need to know that it goes up from k and goes down of k after.
What this algo does is to register the slopes only, so we just need 2 entry, with O(1) complexity.
We just need to know that we are upping from k at the beginning and decreasing at the end.
Finally, the maximum would be...
The addition of all the slopes, that is why it's max(sum) of the tables, because the tables itself registers the slopes