Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Sort the array in ascending order.
For each number in the array, keep track of the smallest and largest numbers in the array that can form a fair pair with this number.
As you move to larger number, both boundaries move down.