Search
⌘K

Leetcode 2567. Minimum Score by Changing Two Elements

Given an integer array where you may replace any two elements arbitrarily, minimize the sum of the maximum and minimum pairwise absolute differences (which, since you can create duplicates, reduces to minimizing the array range after two edits). This is solved by sorting and considering which two endpoints to adjust to get the smallest possible max−min.


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.