3 return indices of the two numbers such that they add up to a specific target.
for(int i=0;i<nums.length;i++){
int component = target-nums[i];
if(map.containsKey(component))
return new int[]{map.get(component),i};
map.put(nums[i],i);
}
for(int i=0;i<nums.length;i++){
int component = target-nums[i];
if(map.containsKey(component))
return new int[]{map.get(component),i};
map.put(nums[i],i);
}