Problems > Closest Pair Sum to Zero > Editorial

Closest Pair Sum to Zero — Solution & Editorial

Back to the Problem

Sort; two pointers from both ends move toward zero: advance the left on negative sums, retreat the right on positive.

Complexity: O(N log N)