public static int[] twoSum(int[] nums, int target) {
        HashMap<Integer, Integer> hash_map = new HashMap<Integer, Integer>();
        int[] result = new int[2];
        for (int i = 0; i < nums.length; ++i) {
            int remain = target - nums[i];
            if (hash_map.containsKey(remain)) {
                result[0] = hash_map.get(remain) + 1;
                result[1] = i + 1;
                return result;
            }
            hash_map.put(nums[i], i);
        }
        throw new IllegalArgumentException("no two sum solution");
    }