public int[] twoSum(int[] nums, int target) {
HashMap<Integer, Integer> map = new HashMap<>();
for (int i = nums.length  1; i >= 0; i) {
if (map.containsKey(target  nums[i])) return new int[] { i, map.get(target  nums[i]) };
map.put(nums[i], i);
}
return null;
}
Java 6 lines 6 ms O(n) solution

@wencheng1994 It is O(n) because, searching a value in a HashMap performs in the order of O(1).
