Problem 1330 · Hard

Reverse Subarray To Maximize Array Value

Reverse at most one subarray to maximize the sum of adjacent absolute differences; only the two boundaries and the best interior pair matter.

Open the interactive visualisation