Given an integer array nums of length n and an integer target, find three integers in nums such that the sum is closest to the target. Return the sum of the three integers. You may assume that each input would have exactly one solution.
Input Format
An Integer representing the size of the array followed by n integers of the array. An Integer representing the target value.
Output Format
An integer
Constraints
1.) 3 <= nums.length <= 1000 2.) -1000 <= nums[i] <= 1000 3.) -10^4 <= target <= 10^4
Example
Input
4 -1 2 1 -4 1
Output
2