001 两数之和
class Solution {public int[] twoSum(int[] nums, int target) {Map<Integer, Integer> hashTable = new HashMap<Integer, Integer>();int[] ans = new int[2];for (int i = 0; i < nums.length; ++i) {if (hashTable.containsKey(target - nums[i])) {ans[0] = i;ans[1] = hashTable.get(target - nums[i]);}hashTable.put(nums[i], i);} // forreturn ans;}}
