摘要:
题目链接 16. 最接近的三数之和 思路 借鉴 【双指针】LeetCode 15. 三数之和 的思路,只不过把0换成 target 代码 class Solution { public int threeSumClosest(int[] nums, int target) { Arrays.sort 阅读全文
摘要:
题目链接 15. 三数之和 思路 可以借鉴 【双指针】LeetCode 167. 两数之和 II - 输入有序数组 的思路,将 nums[i] 作为 target,不断移动 j 和 k 来达到目标。 去重的方法:通过判断 nums[j] == nums[j + 1] 和 nums[k] == num 阅读全文