You are given an array of distinct integers arr[], write a program to find all pairs of elements such that their absolute difference is minimum. Return a list of pairs in ascending order (with respect to pairs), each pair [i, j] follows :

  • i, j are from arr[]
  • i < j
  • j - i equals to the minimum absolute difference of any two elements in arr[].

Example 1

Input: arr[] = [5, 3, 2, 4] 
Output: [[2, 3],[3, 4],[4, 5]] 
Explanation: The minimum absolute difference is 1. List all pairs with difference equal to 1 in ascending order.

Example 2

Input: arr[] = [2, 4, 7, 13, 17]
Output: [[2, 4]]
Explanation: The minimum absolute difference is 2 between the first two elements.

Example 3

Input: arr[] = [1, 7, -12, 22, -8, -16, 18]
Output: [[-12, -8],[-12, -16],[22, 18]]
Explanation: All these pairs have the same minimum absolute difference.