3Sum Closest — sort, fix one, two-point the rest
After sorting, fix the first number and sweep two pointers inward. Nudge them toward the target — left in when the sum is too small, right in when too large — and remember the closest sum seen.
Try:
sorted nums
current sum
closest so far