15. 3Sum 과 유사
class Solution:
    def threeSumClosest(self, nums: List[int], target: int) -> int:
        nums.sort()
        n = len(nums)
        diff = float('inf')
        res = 0

        for i in range(n - 2):
            left = i + 1
            right = n - 1
            while left < right:
                s = nums[left] + nums[right] + nums[i]
                if abs(target - s) < diff:
                    diff = abs(target - s)
                    res = s
                if s < target:
                    left += 1
                else:
                    right -= 1

        return res