Skip to content

Practice Minimum Score by Changing Two Elements

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#2567
LeetCode Problem

Minimum Score by Changing Two Elements

Problem Statement

Define the low score as the smallest absolute difference between two array entries, and the high score as the largest such difference. The array score is their sum. Return the minimum score obtainable by changing two entries of nums.

Source: Minimum Score by Changing Two Elements on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [1,4,7,8,5]
Output
3

# Example 2

Input
nums = [1,4,3]
Output
0

Constraints

3 <= nums.length <= 10^5
1 <= nums[i] <= 10^9

Related LeetCode Problems

Practice more problems similar to Minimum Score by Changing Two Elements.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.