import java.util.*; public class Solution { /** * * @param numbers int整型一维数组 * @param target int整型 * @return int整型一维数组 */ public int[] twoSum (int[] numbers, int target) { int[] result = {-1, -1}; for (int i = 0; i < numbers.length; i++) { int k = target - numbers[i]; for (int j = i + 1; j < numbers.length; j++) { if (k == numbers[j]) { result[0] = i + 1; result[1] = j + 1; return result; } } } return result; } }