Problem 2602 · Medium

Minimum Operations to Make All Array Elements Equal

For each query value, split the sorted numbers at that value and use prefix sums to total the raise and lower costs.

Open the interactive visualisation