Minimum Operations to Make Subarray Elements Equal
Pick every run of k consecutive values and find the cheapest common target; the median of each run is the best choice.
Pick every run of k consecutive values and find the cheapest common target; the median of each run is the best choice.