EasyArray· 63% acceptance
#185

Two Sum 35

Easy

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

Example 1

Input: nums = [35,6,17,28,39,10,21,32,3,14,25,36,7,18,29,0,11,22,47], target = 53

Output: [0,13]

nums[0] + nums[13] = 53

Constraints

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

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

twoSum

← All practice problems