大致思路:双指针遍历。i从前往后遍历,j从后往前遍历。条件是:如果nums[i] + nums[j] > target j–; nums[i] + nums[j] < target i++; 最终i,j指针指向的就是答案。
京公网安备 11010502049817号