Two Numbers With Sum Closest to Zero
Problem Given an array of integers (positive and negative), find the pair whose sum is closest to zero.
Input / Output
- Input: integer array
nums(mix of positive and negative values). - Output: the pair (or its sum) with the smallest absolute sum.
Constraints
- 2 <= n <= 10^5; aim to beat the O(n^2) all-pairs check.
Example
- [1, 60, -10, 70, -80, 85] → (-80, 85), sum 5.
added …