Leetcode 1674. Minimum Moves to Make Array Complementary
Given an even-length array nums and a limit, you may replace any element with a value in [1, limit]; find the minimum number of single-element replacements so that every symmetric pair nums[i] + nums[n-1-i] equals the same target sum. The key challenge is choosing the optimal target sum S (2..2*limit) and efficiently counting, for each pair, whether it needs 0, 1, or 2 moves to reach S under constraints up to 1e5.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.