标签:
这里因为是有序的,可以利用这个有序性来进行查找
left=0,right=num.length-1;
while(left<=right){
sum = num[left] + num[right];
if(sum<target) left++;
else if(sum>target) right--;
else return true;
}
return false;
[Leetcode] Two Sum II - Input array is sorted
标签:
原文地址:http://www.cnblogs.com/deepblueme/p/4725475.html