You are given an array of integers nums and an integer target. Your task is to implement a function that finds the indices of the two numbers such that they add up to target.
nums
target
nums = [2, 7, 11, 15] target = 9 [0, 1]
Explanation:
nums[0] + nums[1] = 2 + 7 = 9
Return [0, 1] as the answer.
[0, 1]
Last updated 1 year ago