import java.util.*;
public class Solution {
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param numbers int整型一维数组
* @param target int整型
* @return int整型一维数组
*/
public int[] twoSum (int[] numbers, int target) {
// write code here
int[] res = new int[2];
HashMap<Integer, Integer> map = new HashMap<>();
for(int i = 0; i < numbers.length; i ++) {
int num = target - numbers[i];
if (!map.containsKey(num)) {
map.put(numbers[i], i);
} else {
res[0] = map.get(num) + 1;
res[1] = i + 1;
}
}
return res;
}
}