Search
⌘K

Leetcode 3424. Minimum Cost to Make Arrays Identical

Given two equal-length arrays, you can pay k to split arr into contiguous blocks and permute them (one such operation can realize any permutation) and/or pay |x| per unit to change individual elements; find the minimum total cost to make arr equal brr. The core challenge is trading a fixed-cost reordering (enabling an optimal value matching) against per-element adjustment costs, i.e., choose whether to keep positions or pay to permute and then minimize sum of absolute differences.


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.