3Sum Closest
MediumGiven an integer array and target, choose three distinct indices whose values have the sum closest to the target. Print that sum.
Input format:
- First line: n target
- Second line: n integers
If two sums are equally close to the target, print the smaller sum.
Constraints
3 <= n <= 3000 -10^5 <= nums[i], target <= 10^5