Problem 2499 · Hard

Minimum Total Cost to Make Arrays Unequal

Every index where the arrays match must be swapped; if one value dominates those indices, borrow extra indices with the smallest positions.

Open the interactive visualisation