1. Create a HashMap to store the elements of the array and their corresponding indices.
2. Iterate through the array, and for each element, calculate the complement by subtracting the current element from the target sum. The complement is the value that, when added to the current element, results in the target sum.
3. Check if the complement is already present in the HashMap. If yes, return the indices of the current element and its complement.
4. If the complement is not present in the HashMap, add the current element and its index to the HashMap.
5. If no two elements are found that sum up to the target, return an empty array or handle it as per the problem's requirements.
Click for My Solution in Github