Tap here to switch tabs
Problem
Submissions

Problem: Minimum Difference Between Max and Min in Three Moves

Minimum Difference Between Max and Min in Three Moves asks you to change at most three array elements to any integers and return the minimum difference between largest and smallest values.

Statement

You are given an integer array nums.

In one move, you can choose any element of nums and change its value to any integer.

Return the minimum difference between the largest and smallest value of nums after performing at most 33 moves.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • −109≤-10^9 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Difference Between Max and Min in Three Moves

Minimum Difference Between Max and Min in Three Moves asks you to change at most three array elements to any integers and return the minimum difference between largest and smallest values.

Statement

You are given an integer array nums.

In one move, you can choose any element of nums and change its value to any integer.

Return the minimum difference between the largest and smallest value of nums after performing at most 33 moves.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • −109≤-10^9 \leq nums[i] ≤109\leq 10^9