algorithm · Level 1 · 15 min
Given an array of integers nums and an integer target, return indices of the two numbers that add up to target.
You may assume each input has exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
nums (array of integers) and target (integer).[i, j] such that nums[i] + nums[j] === target.- `2 <= nums.length <= 10^4` - `-10^9 <= nums[i] <= 10^9` - Only one valid answer exists.
Return the two indices. Order does not matter.