You are given an array of integers nums and an integer target.
Return indices of the two numbers such that they add up to target.
· You may assume there is exactly one solution for each input.
· You cannot use the same element twice.
· The answer can be returned in any order.
Input: nums = [5, 1, 3, 7], target = 8
Output: [0, 2]
Explanation:
nums[0] + nums[2] = 5 + 3 = 8.
Input: nums = [10, 4, 8, 2], target = 12
Output: [1, 2]
Explanation:
nums[1] + nums[2] = 4 + 8 = 12.
Input: nums = [1, 5, 5], target = 10
Output: [1, 2]
Explanation:
nums[1] + nums[2] = 5 + 5 = 10.
Accepted:
Submission: