Skip to content

Commit ec3ec80

Browse files
committed
update problems content
1 parent 99a60dd commit ec3ec80

File tree

4,279 files changed

+131279
-340339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,279 files changed

+131279
-340339
lines changed

assets/output/0001.md

+31-94
Original file line numberDiff line numberDiff line change
@@ -4,113 +4,50 @@
44

55
## 题目
66

7-
Given an array of integers `nums` and an integer `target`, return _indices of
8-
the two numbers such that they add up to`target`_.
7+
<p>给定一个整数数组 <code>nums</code>&nbsp;和一个整数目标值 <code>target</code>,请你在该数组中找出 <strong>和为目标值 </strong><em><code>target</code></em>&nbsp; 的那&nbsp;<strong>两个</strong>&nbsp;整数,并返回它们的数组下标。</p>
98

10-
You may assume that each input would have **_exactly_ one solution**, and you
11-
may not use the _same_ element twice.
9+
<p>你可以假设每种输入只会对应一个答案,并且你不能使用两次相同的元素。</p>
1210

13-
You can return the answer in any order.
11+
<p>你可以按任意顺序返回答案。</p>
1412

13+
<p>&nbsp;</p>
1514

15+
<p><strong class="example">示例 1:</strong></p>
1616

17-
**Example 1:**
17+
<pre>
18+
<strong>输入:</strong>nums = [2,7,11,15], target = 9
19+
<strong>输出:</strong>[0,1]
20+
<strong>解释:</strong>因为 nums[0] + nums[1] == 9 ,返回 [0, 1] 。
21+
</pre>
1822

19-
> Input: nums = [2,7,11,15], target = 9
20-
>
21-
> Output: [0,1]
22-
>
23-
> Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].
23+
<p><strong class="example">示例 2:</strong></p>
2424

25-
**Example 2:**
25+
<pre>
26+
<strong>输入:</strong>nums = [3,2,4], target = 6
27+
<strong>输出:</strong>[1,2]
28+
</pre>
2629

27-
> Input: nums = [3,2,4], target = 6
28-
>
29-
> Output: [1,2]
30+
<p><strong class="example">示例 3:</strong></p>
3031

31-
**Example 3:**
32+
<pre>
33+
<strong>输入:</strong>nums = [3,3], target = 6
34+
<strong>输出:</strong>[0,1]
35+
</pre>
3236

33-
> Input: nums = [3,3], target = 6
34-
>
35-
> Output: [0,1]
37+
<p>&nbsp;</p>
3638

37-
**Constraints:**
39+
<p><strong>提示:</strong></p>
3840

39-
* `2 <= nums.length <= 10^4`
40-
* `-10^9 <= nums[i] <= 10^9`
41-
* `-10^9 <= target <= 10^9`
42-
* **Only one valid answer exists.**
41+
<ul>
42+
<li><code>2 &lt;= nums.length &lt;= 10<sup>4</sup></code></li>
43+
<li><code>-10<sup>9</sup> &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
44+
<li><code>-10<sup>9</sup> &lt;= target &lt;= 10<sup>9</sup></code></li>
45+
<li><strong>只会存在一个有效答案</strong></li>
46+
</ul>
4347

48+
<p>&nbsp;</p>
4449

45-
46-
**Follow-up: **Can you come up with an algorithm that is less than `O(n2)`
47-
time complexity?
48-
49-
50-
## 题目大意
51-
52-
给定一个整数数组 `nums` 和一个整数目标值 `target`,请你在该数组中找出 **和为目标值** _`target`_ 的那 **两个**
53-
整数,并返回它们的数组下标。
54-
55-
你可以假设每种输入只会对应一个答案,并且你不能使用两次相同的元素。
56-
57-
你可以按任意顺序返回答案。
58-
59-
60-
61-
**示例 1:**
62-
63-
>
64-
>
65-
>
66-
>
67-
>
68-
> **输入:** nums = [2,7,11,15], target = 9
69-
>
70-
> **输出:**[0,1]
71-
>
72-
> **解释:** 因为 nums[0] + nums[1] == 9 ,返回 [0, 1]
73-
>
74-
>
75-
76-
**示例 2:**
77-
78-
>
79-
>
80-
>
81-
>
82-
>
83-
> **输入:** nums = [3,2,4], target = 6
84-
>
85-
> **输出:**[1,2]
86-
>
87-
>
88-
89-
**示例 3:**
90-
91-
>
92-
>
93-
>
94-
>
95-
>
96-
> **输入:** nums = [3,3], target = 6
97-
>
98-
> **输出:**[0,1]
99-
>
100-
>
101-
102-
103-
104-
**提示:**
105-
106-
* `2 <= nums.length <= 10^4`
107-
* `-10^9 <= nums[i] <= 10^9`
108-
* `-10^9 <= target <= 10^9`
109-
* **只会存在一个有效答案**
110-
111-
112-
113-
**进阶:** 你可以想出一个时间复杂度小于 `O(n2)` 的算法吗?
50+
<p><strong>进阶:</strong>你可以想出一个时间复杂度小于 <code>O(n<sup>2</sup>)</code> 的算法吗?</p>
11451

11552

11653
## 解题思路
@@ -138,7 +75,7 @@ time complexity?
13875
| 560 | [和为 K 的子数组](https://leetcode.com/problems/subarray-sum-equals-k) | [[]](/problem/0560.md) | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`前缀和`](/tag/prefix-sum.md) | <font color=#ffb800>Medium</font> |
13976
| 653 | [两数之和 IV - 输入二叉搜索树](https://leetcode.com/problems/two-sum-iv-input-is-a-bst) | | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) `4+` | <font color=#15bd66>Easy</font> |
14077
| 1099 | [小于 K 的两数之和](https://leetcode.com/problems/two-sum-less-than-k) | | [`数组`](/tag/array.md) [`双指针`](/tag/two-pointers.md) [`二分查找`](/tag/binary-search.md) `1+` | <font color=#15bd66>Easy</font> |
141-
| 1679 | [K 和数对的最大数目](https://leetcode.com/problems/max-number-of-k-sum-pairs) | | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`双指针`](/tag/two-pointers.md) `1+` | <font color=#ffb800>Medium</font> |
78+
| 1679 | [K 和数对的最大数目](https://leetcode.com/problems/max-number-of-k-sum-pairs) | [[]](/problem/1679.md) | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`双指针`](/tag/two-pointers.md) `1+` | <font color=#ffb800>Medium</font> |
14279
| 1711 | [大餐计数](https://leetcode.com/problems/count-good-meals) | | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) | <font color=#ffb800>Medium</font> |
14380
| 2006 | [差的绝对值为 K 的数对数目](https://leetcode.com/problems/count-number-of-pairs-with-absolute-difference-k) | | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`计数`](/tag/counting.md) | <font color=#15bd66>Easy</font> |
14481
| 2023 | [连接后等于目标字符串的字符串对](https://leetcode.com/problems/number-of-pairs-of-strings-with-concatenation-equal-to-target) | | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`字符串`](/tag/string.md) `1+` | <font color=#ffb800>Medium</font> |

assets/output/0002.md

+28-89
Original file line numberDiff line numberDiff line change
@@ -4,106 +4,45 @@
44

55
## 题目
66

7-
You are given two **non-empty** linked lists representing two non-negative
8-
integers. The digits are stored in **reverse order** , and each of their nodes
9-
contains a single digit. Add the two numbers and return the sum as a linked
10-
list.
7+
<p>给你两个&nbsp;<strong>非空</strong> 的链表,表示两个非负的整数。它们每位数字都是按照&nbsp;<strong>逆序</strong>&nbsp;的方式存储的,并且每个节点只能存储&nbsp;<strong>一位</strong>&nbsp;数字。</p>
118

12-
You may assume the two numbers do not contain any leading zero, except the
13-
number 0 itself.
9+
<p>请你将两个数相加,并以相同形式返回一个表示和的链表。</p>
1410

11+
<p>你可以假设除了数字 0 之外,这两个数都不会以 0&nbsp;开头。</p>
1512

13+
<p>&nbsp;</p>
1614

17-
**Example 1:**
15+
<p><strong class="example">示例 1:</strong></p>
16+
<img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2021/01/02/addtwonumber1.jpg" style="width: 483px; height: 342px;" />
17+
<pre>
18+
<strong>输入:</strong>l1 = [2,4,3], l2 = [5,6,4]
19+
<strong>输出:</strong>[7,0,8]
20+
<strong>解释:</strong>342 + 465 = 807.
21+
</pre>
1822

19-
![](https://assets.leetcode.com/uploads/2020/10/02/addtwonumber1.jpg)
23+
<p><strong class="example">示例 2:</strong></p>
2024

21-
> Input: l1 = [2,4,3], l2 = [5,6,4]
22-
>
23-
> Output: [7,0,8]
24-
>
25-
> Explanation: 342 + 465 = 807.
25+
<pre>
26+
<strong>输入:</strong>l1 = [0], l2 = [0]
27+
<strong>输出:</strong>[0]
28+
</pre>
2629

27-
**Example 2:**
30+
<p><strong class="example">示例 3:</strong></p>
2831

29-
> Input: l1 = [0], l2 = [0]
30-
>
31-
> Output: [0]
32+
<pre>
33+
<strong>输入:</strong>l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]
34+
<strong>输出:</strong>[8,9,9,9,0,0,0,1]
35+
</pre>
3236

33-
**Example 3:**
37+
<p>&nbsp;</p>
3438

35-
> Input: l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]
36-
>
37-
> Output: [8,9,9,9,0,0,0,1]
39+
<p><strong>提示:</strong></p>
3840

39-
**Constraints:**
40-
41-
* The number of nodes in each linked list is in the range `[1, 100]`.
42-
* `0 <= Node.val <= 9`
43-
* It is guaranteed that the list represents a number that does not have leading zeros.
44-
45-
46-
## 题目大意
47-
48-
给你两个 **非空** 的链表,表示两个非负的整数。它们每位数字都是按照 **逆序** 的方式存储的,并且每个节点只能存储 **一位** 数字。
49-
50-
请你将两个数相加,并以相同形式返回一个表示和的链表。
51-
52-
你可以假设除了数字 0 之外,这两个数都不会以 0 开头。
53-
54-
55-
56-
**示例 1:**
57-
58-
![](https://assets.leetcode-cn.com/aliyun-lc-
59-
upload/uploads/2021/01/02/addtwonumber1.jpg)
60-
61-
>
62-
>
63-
>
64-
>
65-
>
66-
> **输入:** l1 = [2,4,3], l2 = [5,6,4]
67-
>
68-
> **输出:**[7,0,8]
69-
>
70-
> **解释:** 342 + 465 = 807.
71-
>
72-
>
73-
74-
**示例 2:**
75-
76-
>
77-
>
78-
>
79-
>
80-
>
81-
> **输入:** l1 = [0], l2 = [0]
82-
>
83-
> **输出:**[0]
84-
>
85-
>
86-
87-
**示例 3:**
88-
89-
>
90-
>
91-
>
92-
>
93-
>
94-
> **输入:** l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]
95-
>
96-
> **输出:**[8,9,9,9,0,0,0,1]
97-
>
98-
>
99-
100-
101-
102-
**提示:**
103-
104-
* 每个链表中的节点数在范围 `[1, 100]`
105-
* `0 <= Node.val <= 9`
106-
* 题目数据保证列表表示的数字不含前导零
41+
<ul>
42+
<li>每个链表中的节点数在范围 <code>[1, 100]</code> 内</li>
43+
<li><code>0 &lt;= Node.val &lt;= 9</code></li>
44+
<li>题目数据保证列表表示的数字不含前导零</li>
45+
</ul>
10746

10847

10948
## 解题思路

0 commit comments

Comments
 (0)