Java(题目来源:LeetCode)Here
(1)建立哈希表Map<Integer, Integer> map = new HashMap<>();
其中map的key是nums[i],value是i(nums数组中的值以及它对应的数组下标)
(2)遍历nums数组并做判断temp = target - i; if( map.containsKey(temp))
如果存在,直接返回return new int[] { map.get(temp), i}; // 返回符合要求的数组下标值对
如果不存在,则map.put(nums[i], i);
(3)经过以上步骤没有得出答案,抛出异常throw new IllegalArgumentException("No Solution.");