【16.|16. 3Sum Closest】与3Sum思路相同
class Solution {
public int threeSumClosest(int[] nums, int target) {
int mindis = Integer.MAX_VALUE;
Arrays.sort(nums);
int sum = 0;
int len = nums.length;
for(int i=0;
i0&&i0){
q--;
}else{
return target;
}
}
}
return sum;
}
}