标签:inpu else number script == company input esc bre
https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/description/
package com.company; public class Solution { public int[] twoSum(int[] numbers, int target) { int len=numbers.length; if(len==0||len==1) return null; int[] res=new int[2]; int right=len-1; int left=0; while(left<right) { if(numbers[left]+numbers[right]==target) { res[0]=left+1; res[1]=right+1; break; } else if(numbers[left]+numbers[right]>target) { right--; } else { left++; } } return res; } }
167. Two Sum II - Input array is sorted
标签:inpu else number script == company input esc bre
原文地址:http://www.cnblogs.com/aguai1992/p/7296304.html