leetcode 167 两数之和2,输入有序数组
解题思路:双指针碰撞
class Solution { public int[] twoSum(int[] numbers, int target) { int len = numbers.length; int start = 0; int end = len - 1; while(starttarget){ --end; }else if(numbers[start]+numbers[end]
本文共 354 字,大约阅读时间需要 1 分钟。
leetcode 167 两数之和2,输入有序数组
解题思路:双指针碰撞
class Solution { public int[] twoSum(int[] numbers, int target) { int len = numbers.length; int start = 0; int end = len - 1; while(starttarget){ --end; }else if(numbers[start]+numbers[end]
转载于:https://www.cnblogs.com/erdanyang/p/11496092.html