// Use a HashMap to store each number with its index. // For every element, calculate the required complement (target - current number). // If the complement already exists in the HashMap, // we have ...
Given an integer array nums and an integer target, find two different elements in the array whose sum is equal to the target. Return the indices of those two elements.