Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 969c0e4

Browse files
authored
Added description for tasks 1, 2.
1 parent 6e208bd commit 969c0e4

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
1\. Two Sum
2+
3+
Easy
4+
5+
Given an array of integers `nums` and an integer `target`, return _indices of the two numbers such that they add up to `target`_.
6+
7+
You may assume that each input would have **_exactly_ one solution**, and you may not use the _same_ element twice.
8+
9+
You can return the answer in any order.
10+
11+
**Example 1:**
12+
13+
**Input:** nums = \[2,7,11,15\], target = 9
14+
15+
**Output:** \[0,1\]
16+
17+
**Output:** Because nums\[0\] + nums\[1\] == 9, we return \[0, 1\].
18+
19+
**Example 2:**
20+
21+
**Input:** nums = \[3,2,4\], target = 6
22+
23+
**Output:** \[1,2\]
24+
25+
**Example 3:**
26+
27+
**Input:** nums = \[3,3\], target = 6
28+
29+
**Output:** \[0,1\]
30+
31+
**Constraints:**
32+
33+
* `2 <= nums.length <= 104`
34+
* `-109 <= nums[i] <= 109`
35+
* `-109 <= target <= 109`
36+
* **Only one valid answer exists.**
37+
38+
**Follow-up:** Can you come up with an algorithm that is less than `O(n2) `time complexity?
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2\. Add Two Numbers
2+
3+
Medium
4+
5+
You are given two **non-empty** linked lists representing two non-negative integers. The digits are stored in **reverse order**, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
6+
7+
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
8+
9+
**Example 1:**
10+
11+
![](https://assets.leetcode.com/uploads/2020/10/02/addtwonumber1.jpg)
12+
13+
**Input:** l1 = \[2,4,3\], l2 = \[5,6,4\]
14+
15+
**Output:** \[7,0,8\] **Explanation:** 342 + 465 = 807.
16+
17+
**Example 2:**
18+
19+
**Input:** l1 = \[0\], l2 = \[0\]
20+
21+
**Output:** \[0\]
22+
23+
**Example 3:**
24+
25+
**Input:** l1 = \[9,9,9,9,9,9,9\], l2 = \[9,9,9,9\]
26+
27+
**Output:** \[8,9,9,9,0,0,0,1\]
28+
29+
**Constraints:**
30+
31+
* The number of nodes in each linked list is in the range `[1, 100]`.
32+
* `0 <= Node.val <= 9`
33+
* It is guaranteed that the list represents a number that does not have leading zeros.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /