Problem 1005 · Easy

Maximize Sum Of Array After K Negations

Flip the sign of exactly k elements to maximize the array sum. The bars show the greedy choice of flipping the most negative values first and handling leftover flips by parity.

Open the interactive visualisation