Practice Minimum Difference Between Largest and Smallest Value in Three Moves
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given an integer array nums. In one move, you can choose one element of nums and change it to any value. Return the minimum difference between the largest and smallest value of nums after performing at most three moves.
Source: Minimum Difference Between Largest and Smallest Value in Three Moves on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [5,3,2,4]
Output
0
# Example 2
Input
nums = [1,5,0,10,14]
Output
1
# Example 3
Input
nums = [3,100,20]
Output
0
Constraints
1 <= nums.length <= 10^5
-10^9 <= nums[i] <= 10^9
Related LeetCode Problems
Practice more problems similar to Minimum Difference Between Largest and Smallest Value in Three Moves.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.