Arrays & HashingEasy

Two Sum

Return the indexes of the two numbers in nums that add up to target. There is always exactly one answer, and you can't use the same index twice. The two indexes can be in either order.

Example 1nums = [3, 8, 11, 5], target = 13 → [1, 3]8 + 5 = 13.
Example 2nums = [6, 6], target = 12 → [0, 1]
2 ≤ n ≤ 10⁴ · one answer exists

Hints

0 of 3 open
Hint 2 · the patternHint 3 · the key line