Problem 1703 · Hard
Shift each window of k ones toward its median one so the cost becomes a sum of absolute distances.
Open the interactive visualisation