Watch 10 video solutions for Minimum Score by Changing Two Elements, a medium level problem involving Array, Greedy, Sorting. This walkthrough by NeetCode has 19,321 views views. Want to try solving it yourself? Practice on FleetCode or read the detailed text solution.
You are given an integer array nums.
nums is the minimum absolute difference between any two integers.nums is the maximum absolute difference between any two integers.nums is the sum of the high and low scores.Return the minimum score after changing two elements of nums.
Example 1:
Input: nums = [1,4,7,8,5]
Output: 3
Explanation:
nums[0] and nums[1] to be 6 so that nums becomes [6,6,7,8,5].Example 2:
Input: nums = [1,4,3]
Output: 0
Explanation:
nums[1] and nums[2] to 1 so that nums becomes [1,1,1].
Constraints:
3 <= nums.length <= 1051 <= nums[i] <= 109