Problem 3077 · Hard

Maximum Strength of K Disjoint Subarrays

Scan left to right with two states per subarray count, open or closed, and weight the j-th chosen subarray by its alternating sign and k - j + 1.

Open the interactive visualisation