FastPrepFastPrep
Problem Brief

Min Amplitude

FULLTIMEOA
See Google online assessment and hiring insights

Given an Array A, find the minimum amplitude you can get after changing up to 3 elements. Amplitude is the range of the array (basically difference between largest and smallest element).

1Example 1

Input
A = [-1, 3, -1, 8, 5, 4]
Output
2
Explanation
We can change -1, -1, 8 to 3, 4 or 5.

2Example 2

Input
A = [10, 10, 3, 4, 10]
Output
0
Explanation
Change 3 and 4 to 10.

Constraints

Limits and guarantees your solution can rely on.

We dont know it yet. If you happen to know about it feel free to let us know tysm! ^3^
public int minAmplitude(int[] A) {
  // write your code here
}
Input

A

[-1, 3, -1, 8, 5, 4]

Output

2

Sign in to submit your solution.