EasyArray· 64% acceptance
#203

Two Sum 53

Easy

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

Example 1

Input: nums = [13,10,35,6,17,28,39,10,21,32,3,14,25,36,7,18,23], target = 33

Output: [1,16]

nums[1] + nums[16] = 33

Constraints

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

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

twoSum

← All practice problems