Given an array of integers and a target, return the indices of the two numbers that add up to the target. Exactly one valid pair is guaranteed to exist.
Example 1
Explanation: nums[0] + nums[1] == 9, so we return their indices [0, 1].
Example 2
Explanation: nums[1] + nums[2] == 6.
Example 3
Can you come up with an algorithm that runs in less than O(n^2) time complexity?
Code execution is coming soon.