//双指针
class Solution { public int[] twoSum(int[] numbers, int target) { int[] arr=new int[2]; //权限校验 if(numbers==null||numbers.length==0){ return arr; } int start=0; int end=numbers.length-1; while(start<end){ if(numbers[start]+numbers[end]<target){ start++; }else if(numbers[start]+numbers[end]>target){ end--; }else{ arr[0]=start+1; arr[1]=end+1; break; } } return arr; } }