Skip to content

Commit 142c2f5

Browse files
authored
Add files via upload
1 parent b132ca5 commit 142c2f5

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
1. Two Sum (Easy)
2+
3+
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
4+
5+
You may assume that each input would have exactly one solution, and you may not use the same element twice.
6+
7+
You can return the answer in any order.
8+
9+
10+
11+
Example 1:
12+
13+
Input: nums = [2,7,11,15], target = 9
14+
Output: [0,1]
15+
Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].
16+
Example 2:
17+
18+
Input: nums = [3,2,4], target = 6
19+
Output: [1,2]
20+
Example 3:
21+
22+
Input: nums = [3,3], target = 6
23+
Output: [0,1]
24+
25+
26+
Constraints:
27+
28+
2 <= nums.length <= 104
29+
-109 <= nums[i] <= 109
30+
-109 <= target <= 109
31+
Only one valid answer exists.

0 commit comments

Comments
 (0)