#44 - two sum problem

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.

Example 1

nums = [2, 7, 11, 15]
target = 9

[0, 1]

Explanation:

  • nums[0] + nums[1] = 2 + 7 = 9

  • Return [0, 1] as the answer.

Last updated