Problem
Given an array of distinct integers, find the smallest absolute difference between any two elements, then print every pair of elements that achieves that difference.
Input / Output
n (the array size), followed by n integers.a b with the smaller number first. Print every pair whose absolute difference equals the minimum, ordered ascending by the first element of the pair.Constraints
Example
Input: n = 4, numbers = [6, 2, 4, 10]
Output:
2 4
4 6
The minimum difference is 2, achieved by (2,4) and (4,6); (6,10) differs by 4 so it is not printed. A tie case: [1, 3, 5, 7] → min diff 2, so all of 1 3, 3 5, 5 7 are printed.