LeetCode 16 3Sum Closest - Problem Statement

The problem

Given an integer array nums and an integer target, find three integers in nums such that their sum is closest to target. Return that sum.

With nums = [-1, 2, 1, -4] and target = 1, the answer is 2. The triplet [-1, 2, 1] sums to 2, which is the closest to 1.

This is similar to 3Sum, but instead of finding sums equal to zero, you're finding the sum closest to a target. How would you adapt the two-pointer approach?

Constraints: 3n5003 \le n \le 500, values from 103-10^3 to 10310^3.