MediumArray· 51% acceptance
#153

Two Sum 3

Medium

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

Example 1

Input: nums = [3,10,25,36,7,18,23], target = 33

Output: [1,6]

nums[1] + nums[6] = 33

Constraints

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

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

twoSum

← All practice problems