//空间换时间

public int[] twoSum (int[] numbers, int target) {
        // write code here
        Map<Integer,Integer> map=new HashMap<>();
        int[] res =new int[2];
        for(int i=0;i<numbers.length;i++){
            int cur=numbers[i];
            if(map.containsKey(target-cur)){
                res[0]=map.get(target-cur);
                res[1]=i+1;
                return res;
            }else map.put(cur,i+1);
        }
        return res;
    }