Minimum Cost to Make Array Equal
Each change costs its weight per step, so the best target is the weighted median of the values: sort by value and stop where half the total cost is reached.
Each change costs its weight per step, so the best target is the weighted median of the values: sort by value and stop where half the total cost is reached.