Input: A[] = {5, 2, 10}, B[] = {6, 8, 89}
Output: {5, 5}, {2, 8}, {11, 88}
Explanation: For first element of both array (5, 5) and (6, 6)
are the only possible pairs and for both of them the value of |X-Y| is 0.
And for second element of both array (6, 8), (8, 6), (2, 8), (8, 2),
(4, 6), (6, 4), (2, 6), (6, 2), (2, 4), (4, 2) and (2, 2) are the pairs out of which |X-Y|
is maximum for (2, 8) and (8, 2).
Similarly, for third element both the arrays have (11, 88) as a possible pair.
Input: A[] = {1, 12}, B[] = {6, 39}
Output: {6, 1}, {13, 39}
Below is the implementation of the above approach.