You are given an array nums of n integers and an integer target, find three integers in nums such that their sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution.
nums = [-1, 2, 1, -4]
target = 1
2
The sum that is closest to the target is 2. (-1 + 2 + 1 = 2).
nums = [0, 0, 0]
target = 1
0
The only possible sum is 0 (0 + 0 + 0 = 0), which is closest to 1.
nums = [1, 1, -1, -1, 3]
target = -1
-1
The sum -1 + -1 + 1 = -1 is the closest to the target -1.
nums = [-1, 2, 1, -4]
target = 1
2