Problem 2321 · Hard

Maximum Score Of Spliced Array

Swapping one interval gains the best subarray of the element differences, so two Kadane passes find the best splice in either direction.

Open the interactive visualisation