EasyArray· 73% acceptance
#178

Two Sum 28

Easy

Given `nums` and `target`, return indices of two distinct numbers that add up to `target`. Exactly one solution exists. Variant **#28**.

Example 1

Input: nums = [28,35,10,21,32,3,14,25,36,7,18,48], target = 83

Output: [1,11]

nums[1] + nums[11] = 83

Constraints

  • 2 <= nums.length <= 10^4
  • Each input has exactly one solution

Acceptance: 73% · Topics: array, hash-table

twoSum

← All practice problems