#### 範例輸入1

10
-20 -3916237 -357920 -3620601 7374819 -7330761 30 6246457 -6461594 266854

-20 30

#### 額外解釋1

|-20 - 30| = 50，50為此陣列中「任一組元素相減的絕對值」的最小值。

#### 範例輸入2

12
-20 -3916237 -357920 -3620601 7374819 -7330761 30 6246457 -6461594 266854 -520 -470

-520 -470 -20 30

#### 額外解釋2

|-470 - (-520)| = |-20 - 30| = 50，50為此陣列中「任一組元素相減的絕對值」的最小值。

4
5 4 3 2

2 3 3 4 4 5

#### 參考答案

```import java.util.*;

public class Solution {

public static void quickSortIterative(final int[] array) {
final int[] stack = new int[array.length];
int top = -1;
int s, e;
stack[++top] = 0;
stack[++top] = array.length - 1;
while (top >= 0) {
e = stack[top--];
s = stack[top--];
final int x = array[s]; // pivot
int l = s + 1;
int r = e;
while (true) {
while (r > s && array[r] >= x) {
--r;
}
while (l <= r && array[l] <= x) {
++l;
}
if (l < r) {
final int buffer = array[l];
array[l] = array[r];
array[r] = buffer;
} else {
if (r > s) {
final int buffer = array[r];
array[r] = array[s];
array[s] = buffer;
}
break;
}
}
final int ls = s, le = r - 1;
final int rs = r + 1, re = e;
final int ll = le - ls + 1, rl = re - rs + 1;
if (ll > 1) {
stack[++top] = ls;
stack[++top] = le;
}
if (rl > 1) {
stack[++top] = rs;
stack[++top] = re;
}
}
}

public static void main(final String[] args) {
final Scanner in = new Scanner(System.in);
final int n = in.nextInt();

final int[] A = new int[n];

for (int i = 0; i < n; ++i) {
A[i] = in.nextInt();
}
quickSortIterative(A);

final ArrayList<Integer> smallestPair = new ArrayList<>();
final int n_dec = n - 1;
int smallDifference = Integer.MAX_VALUE;
for (int i = 0; i < n_dec; ++i) {
final int d = A[i + 1] - A[i];
if (d <= smallDifference) {
if (d < smallDifference) {
smallDifference = d;
smallestPair.clear();
}