Problem 4058 · Medium

Maximum Pulse Value After One Subarray Rotation

Alternating signs decide the pulse. One left rotation of a segment only changes the two ends, so each right end needs just the best earlier left end.

Open the interactive visualisation