• + 2 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.