what is the reason we are sorting based on absolute difference between pairs
Intutition behind sorting
After sorting, you get to know that all the numbers ahead of Ai are greater than it.
So it helps you to stop earlier.
but we need current Ai to be greater than next values in the arrray