Search
⌘K

Leetcode 2499. Minimum Total Cost to Make Arrays Unequal

Given nums1 and nums2, you may swap any two indices in nums1 at cost equal to the sum of their indices; find the minimum total cost to make nums1[i] != nums2[i] for every i (or return -1 if impossible). The core challenge is a weighted swap-optimization under frequency constraints—choosing which indices (including non-conflicting ones) to use in swaps to resolve equalities while minimizing the total index-sum cost.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.