class Solution { public int[] twoSum(int[] numbers, int target) { int[] arr = new int[2]; for(int i = 0;i < numbers.length;i++){ arr[0] = i+1; for(int j = i + 1;j < numbers.length;j++){ if(numbers[j] + numbers[i] == target){ arr[1] = j+1; return arr; } } } return arr; } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)