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.
I'm still trying to figure it out myself. But if you graph result after doing the operations, you would see some rise and fall in the graph.
It looks like his solution tracks the differences between each data point. It went up by x, down by y, remained the same...etc. And his solutions finds the highest increase.
Example:
5 3
1 2 100
2 5 100
3 4 100
After doing the operations you get [100, 200, 200, 200, 100]
His solutions final array is [0, 100, 100, 0, 0, -100]
Meaning starting at 0 the graph went up by 100, went up by 100 again, remained the same, then went back down by 100.
Array Manipulation
You are viewing a single comment's thread. Return to all comments →
I'm still trying to figure it out myself. But if you graph result after doing the operations, you would see some rise and fall in the graph.
It looks like his solution tracks the differences between each data point. It went up by x, down by y, remained the same...etc. And his solutions finds the highest increase.
Example: 5 3
1 2 100
2 5 100
3 4 100
After doing the operations you get [100, 200, 200, 200, 100] His solutions final array is [0, 100, 100, 0, 0, -100] Meaning starting at 0 the graph went up by 100, went up by 100 again, remained the same, then went back down by 100.
So the highest point is 200, the solution.
you add up all the numbers > 0 in the final list, which is 100 + 100 = 200
Hi,
I have created a video tutorial for you and uploaded the same on youtube. Here is the video tutorial for my solution O(n+m) complexity.
https://youtu.be/hDhf04AJIRs
Would really appreciate your feedback like, dislike , comment etc. on my video.