EasyArray· 69% acceptance
#208

Two Sum 58

Easy

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

Example 1

Input: nums = [18,25,0,11,22,33,4,15,26,37,8,19,30,1,12,23,34,5,16,27,38,8], target = 33

Output: [0,7]

nums[0] + nums[7] = 33

Constraints

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

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

twoSum

← All practice problems