arrow_back Back to Challenges

#1 Two Sum

Easy Acceptance 0%
description

Problem Description

Given an array of integers `nums` and an integer `target`, return indices of the two numbers such that they add up to `target`. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order.

checklist Constraints

2 <= nums.length <= 10^4
-10^9 <= nums[i] <= 10^9
-10^9 <= target <= 10^9
Only one valid answer exists.

science Examples

Case #1

In: nums = [2,7,11,15] target = 9
Out: [0, 1]

Case #2

In: nums = [3,2,4] target = 6
Out: [1, 2]

Mastery Tags

Arrays Hash Table

Hiring Companies

Amazon Google Meta
code

Integrated IDE

code_blocks
Coding
psychology
Aptitude