Minimum Absolute Difference
All numbers in arr are different. Find the smallest difference between any two of them, then return every pair [a, b] with a < b whose difference equals that smallest value.
List the pairs in increasing order of a.
Example 1
arr [4,2,1,3]
returns [[1,2],[2,3],[3,4]]
The smallest gap is 1: [1, 2], [2, 3], [3, 4].
Example 2
arr [1,3,6,10,15]
returns [[1,3]]
The smallest gap is 2, only between 1 and 3.
Constraints
2 <= len(arr) <= 20- All numbers are different.
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.