3 sum 的变形题
Solution1:
sort first, then iterate the array, fix one element, using two pointer to calculate the sum for 3 elements, using absolute value to determine which is the closest result.
time: O(n^2), space: O(1)
3 sum 的变形题
sort first, then iterate the array, fix one element, using two pointer to calculate the sum for 3 elements, using absolute value to determine which is the closest result.
time: O(n^2), space: O(1)