Skip to content

Commit 3ecc85a

Browse files
Merge pull request SharingSource#692 from SharingSource/ac_oier
✨feat: add 面试题 17.09、263、264、84、739
2 parents 5e577b5 + a690506 commit 3ecc85a

11 files changed

+578
-42
lines changed

Index/单调栈.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
| 题目 | 题解 | 难度 | 推荐指数 |
22
| ------------------------------------------------------------ | ------------------------------------------------------------ | ---- | -------- |
33
| [42. 接雨水](https://leetcode-cn.com/problems/trapping-rain-water/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/trapping-rain-water/solution/po-su-jie-fa-on2-cha-zhao-you-hua-on-dan-iu44/) | 困难 | 🤩🤩🤩🤩 |
4+
| [84. 柱状图中最大的矩形](https://leetcode.cn/problems/largest-rectangle-in-histogram/) | [LeetCode 题解链接](https://leetcode.cn/problems/largest-rectangle-in-histogram/solution/by-ac_oier-i470/) | 困难 | 🤩🤩🤩🤩 |
45
| [456. 132 模式](https://leetcode-cn.com/problems/132-pattern/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/132-pattern/solution/xiang-xin-ke-xue-xi-lie-xiang-jie-wei-he-95gt/) | 中等 | 🤩🤩🤩 |
56
| [496. 下一个更大元素 I](https://leetcode-cn.com/problems/next-greater-element-i/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/next-greater-element-i/solution/gong-shui-san-xie-yi-ti-shuang-jie-bian-n6nwz/) | 中等 | 🤩🤩🤩🤩 |
67
| [503. 下一个更大元素 II](https://leetcode-cn.com/problems/next-greater-element-ii/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/next-greater-element-ii/solution/cong-po-su-jie-fa-de-jiao-du-qu-li-jie-d-trht/) | 中等 | 🤩🤩🤩 |
78
| [654. 最大二叉树](https://leetcode.cn/problems/maximum-binary-tree/) | [LeetCode 题解链接](https://leetcode.cn/problems/maximum-binary-tree/solution/by-ac_oier-s0wc/) | 中等 | 🤩🤩🤩🤩🤩 |
9+
| [739. 每日温度](https://leetcode.cn/problems/daily-temperatures/) | [LeetCode 题解链接](https://leetcode.cn/problems/daily-temperatures/solution/by-ac_oier-aj5k/) | 中等 | 🤩🤩🤩🤩 |
810
| [907. 子数组的最小值之和](https://leetcode.cn/problems/sum-of-subarray-minimums/) | [LeetCode 题解链接](https://leetcode.cn/problems/sum-of-subarray-minimums/solution/by-ac_oier-h9cd/) | 中等 | 🤩🤩🤩🤩 |
911
| [1475. 商品折扣后的最终价格](https://leetcode.cn/problems/final-prices-with-a-special-discount-in-a-shop/) | [LeetCode 题解链接](https://leetcode.cn/problems/final-prices-with-a-special-discount-in-a-shop/solution/by-ac_oier-hw5b/) | 简单 | 🤩🤩🤩🤩🤩 |
1012
| [2104. 子数组范围和](https://leetcode-cn.com/problems/sum-of-subarray-ranges/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/sum-of-subarray-ranges/solution/gong-shui-san-xie-yi-ti-san-jie-qu-jian-wn84z/) | 中等 | 🤩🤩🤩🤩🤩 |

Index/双指针.md

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
| [2024. 考试的最大困扰度](https://leetcode-cn.com/problems/maximize-the-confusion-of-an-exam/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/maximize-the-confusion-of-an-exam/solution/by-ac_oier-2rii/) | 中等 | 🤩🤩🤩🤩 |
6464
| [2047. 句子中的有效单词数](https://leetcode-cn.com/problems/number-of-valid-words-in-a-sentence/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/number-of-valid-words-in-a-sentence/solution/gong-shui-san-xie-jian-dan-zi-fu-chuan-m-5pcz/) | 简单 | 🤩🤩🤩🤩 |
6565
| [面试题 01.05. 一次编辑](https://leetcode.cn/problems/one-away-lcci/) | [LeetCode 题解链接](https://leetcode.cn/problems/one-away-lcci/solution/by-ac_oier-7ml0/) | 中等 | 🤩🤩🤩🤩 |
66+
| [面试题 17.09. 第 k 个数](https://leetcode.cn/problems/get-kth-magic-number-lcci/) | [LeetCode 题解链接](https://leetcode.cn/problems/get-kth-magic-number-lcci/solution/by-ac_oier-2czm/) | 中等 | 🤩🤩🤩🤩🤩 |
6667
| [面试题 17.11. 单词距离](https://leetcode.cn/problems/find-closest-lcci/) | [LeetCode 题解链接](https://leetcode.cn/problems/find-closest-lcci/solution/by-ac_oier-0hv9/) | 中等 | 🤩🤩🤩🤩 |
6768
| [剑指 Offer II 007. 数组中和为 0 的三个数](https://leetcode.cn/problems/1fGaJU/) | [LeetCode 题解链接](https://leetcode.cn/problems/1fGaJU/solution/by-ac_oier-6mfb/) | 中等 | 🤩🤩🤩🤩 |
6869
| [剑指 Offer II 009. 乘积小于 K 的子数组](https://leetcode.cn/problems/ZVAVXX/) | [LeetCode 题解链接](https://leetcode.cn/problems/ZVAVXX/solution/by-ac_oier-lop5/) | 中等 | 🤩🤩🤩🤩 |

Index/堆.md

+1
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@
2929
| [1834. 单线程 CPU](https://leetcode-cn.com/problems/single-threaded-cpu/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/single-threaded-cpu/solution/gong-shui-san-xie-shu-ju-jie-gou-yun-yon-1qk0/) | 中等 | 🤩🤩🤩🤩 |
3030
| [剑指 Offer 41. 数据流中的中位数](https://leetcode.cn/problems/shu-ju-liu-zhong-de-zhong-wei-shu-lcof/) | [LeetCode 题解链接](https://leetcode.cn/problems/shu-ju-liu-zhong-de-zhong-wei-shu-lcof/solution/by-ac_oier-exn5/) | 困难 | 🤩🤩🤩🤩🤩 |
3131
| [剑指 Offer 59 - I. 滑动窗口的最大值](https://leetcode.cn/problems/hua-dong-chuang-kou-de-zui-da-zhi-lcof/) | [LeetCode 题解链接](https://leetcode.cn/problems/hua-dong-chuang-kou-de-zui-da-zhi-lcof/solution/by-ac_oier-sjym/) | 困难 | 🤩🤩🤩🤩🤩 |
32+
| [面试题 17.09. 第 k 个数](https://leetcode.cn/problems/get-kth-magic-number-lcci/) | [LeetCode 题解链接](https://leetcode.cn/problems/get-kth-magic-number-lcci/solution/by-ac_oier-2czm/) | 中等 | 🤩🤩🤩🤩🤩 |
3233
| [面试题 17.14. 最小K个数](https://leetcode-cn.com/problems/smallest-k-lcci/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/smallest-k-lcci/solution/gong-shui-san-xie-yi-ti-si-jie-you-xian-yy5k5/) | 中等 | 🤩🤩🤩🤩 |
3334

Index/多路归并.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
| [373. 查找和最小的K对数字](https://leetcode-cn.com/problems/find-k-pairs-with-smallest-sums/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/find-k-pairs-with-smallest-sums/solution/gong-shui-san-xie-duo-lu-gui-bing-yun-yo-pgw5/) | 中等 | 🤩🤩🤩🤩🤩 |
77
| [786. 第 K 个最小的素数分数](https://leetcode-cn.com/problems/k-th-smallest-prime-fraction/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/k-th-smallest-prime-fraction/solution/gong-shui-san-xie-yi-ti-shuang-jie-you-x-8ymk/) | 中等 | 🤩🤩🤩 |
88
| [1305. 两棵二叉搜索树中的所有元素](https://leetcode-cn.com/problems/all-elements-in-two-binary-search-trees/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/all-elements-in-two-binary-search-trees/solution/by-ac_oier-c8fv/) | 中等 | 🤩🤩🤩🤩 |
9+
| [面试题 17.09. 第 k 个数](https://leetcode.cn/problems/get-kth-magic-number-lcci/) | [LeetCode 题解链接](https://leetcode.cn/problems/get-kth-magic-number-lcci/solution/by-ac_oier-2czm/) | 中等 | 🤩🤩🤩🤩🤩 |
910

LeetCode/261-270/263. 丑数(简单).md

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
Tag : 「数学」、「模拟」
66

7-
给你一个整数 n ,请你判断 n 是否为 丑数 。如果是,返回 true ;否则,返回 false 。
87

9-
丑数 就是只包含质因数 2、3 和/或 5 的正整数。
108

11-
 
9+
给你一个整数 `n` ,请你判断 n 是否为 丑数 。如果是,返回 `true` ;否则,返回 `false`
10+
11+
丑数 就是只包含质因数 `2``3` 和 `5` 的正整数。
1212

1313
示例 1:
1414
```
@@ -44,18 +44,18 @@ Tag : 「数学」、「模拟」
4444
```
4545

4646
提示:
47-
* -$2^{31}$ <= n <= $2^{31}$ - 1
47+
* $-2^{31} <= n <= 2^{31} - 1$
4848

4949
---
5050

5151
### 朴素解法
5252

5353
输入范围是 $-2^{31} <= n <= 2^{31} - 1$,我们只需要对输入进行分情况讨论即可:
5454

55-
* 如果 $n$ 不是正整数(即小于等于 0):必然不是丑数,直接返回 false。
56-
* 如果 $n$ 是正整数:我们对 $n$ 执行 2 3 5 的整除操作即可,直到 $n$ 被除干净,如果 $n$ 最终为 1 说明是丑数,否则不是丑数。
55+
* 如果 $n$ 不是正整数(即小于等于 0):必然不是丑数,直接返回 `false`
56+
* 如果 $n$ 是正整数:我们对 $n$ 执行 `2``3``5` 的整除操作即可,直到 $n$ 被除干净,如果 $n$ 最终为 1 说明是丑数,否则不是丑数。
5757

58-
注意,2 3 5 先除哪一个都是可以的,因为乘法本身具有交换律。
58+
注意,`2` `3` `5` 先除哪一个都是可以的,因为乘法本身具有交换律。
5959

6060
代码:
6161
```java
@@ -69,7 +69,7 @@ class Solution {
6969
}
7070
}
7171
```
72-
* 时间复杂度:当 $n$ 是以 2 为底的对数时,需要除以 $log{n}$ 次。复杂度为 $O(log{n})$
72+
* 时间复杂度:当 $n$ 是以 $2$ 为底的对数时,需要除以 $\log{n}$ 次。复杂度为 $O(\log{n})$
7373
* 空间复杂度:$O(1)$
7474

7575
---

LeetCode/261-270/264. 丑数 II(中等).md

+142-16
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ Tag : 「多路归并」、「优先队列(堆)」
66

77

88

9-
给你一个整数 n ,请你找出并返回第 n 个 丑数 。
9+
给你一个整数 `n` ,请你找出并返回第 `n` 个 丑数 。
1010

11-
丑数 就是只包含质因数 2、3 和 5 的正整数。
11+
丑数 就是只包含质因数 `2``3` 和 `5` 的正整数。
1212

1313
示例 1:
1414
```
@@ -28,7 +28,7 @@ Tag : 「多路归并」、「优先队列(堆)」
2828
```
2929

3030
提示:
31-
* 1 <= n <= 1690
31+
* $1 <= n <= 1690$
3232

3333
---
3434

@@ -41,7 +41,7 @@ Tag : 「多路归并」、「优先队列(堆)」
4141

4242
---
4343

44-
### 优先队列(小根堆)解法
44+
### 优先队列(小根堆)
4545

4646
有了基本的分析思路,一个简单的解法是使用优先队列:
4747

@@ -52,8 +52,8 @@ Tag : 「多路归并」、「优先队列(堆)」
5252

5353
为了防止同一丑数多次进队,我们需要使用数据结构 $Set$ 来记录入过队列的丑数。
5454

55-
代码:
56-
```java
55+
Java 代码:
56+
```Java
5757
class Solution {
5858
int[] nums = new int[]{2,3,5};
5959
public int nthUglyNumber(int n) {
@@ -76,31 +76,83 @@ class Solution {
7676
}
7777
}
7878
```
79+
Python 代码:
80+
```Python
81+
class Solution(object):
82+
def nthUglyNumber(self, n):
83+
"""
84+
:type n: int
85+
:rtype: int
86+
"""
87+
nums = [2,3,5]
88+
explored = {1}
89+
pq = [1]
90+
for i in range(1, n+1):
91+
x = heapq.heappop(pq)
92+
if i == n:
93+
return x
94+
for num in nums:
95+
t = num * x
96+
if t not in explored:
97+
explored.add(t)
98+
heapq.heappush(pq,t)
99+
return -1
100+
```
101+
C++ 代码:
102+
```C++
103+
class Solution {
104+
public:
105+
int nthUglyNumber(int n) {
106+
int nums[] = {2, 3, 5};
107+
set<long> s;
108+
priority_queue<long, vector<long>, greater<long>> q;
109+
s.insert(1);
110+
q.push(1);
111+
for (int i = 1; i <= n; i++)
112+
{
113+
long x = q.top();
114+
q.pop();
115+
if (i == n)
116+
return (int)x;
117+
for (int num = 0; num < 3; num++)
118+
{
119+
long t = nums[num] * x;
120+
if (!s.count(t))
121+
{
122+
s.insert(t);
123+
q.push(t);
124+
}
125+
}
126+
}
127+
return -1;
128+
}
129+
};
130+
```
79131
* 时间复杂度:从优先队列中取最小值为 $O(1)$,往优先队列中添加元素复杂度为 $O(\log{n})$。整体复杂度为 $O(n\log{n})$
80132
* 空间复杂度:$O(n)$
81133
82134
---
83135
84-
### 多路归并(多指针)解法
136+
### 多路归并(多指针)
85137
86138
从解法一中不难发现,我们「往后产生的丑数」都是基于「已有丑数」而来(使用「已有丑数」乘上「质因数」$2$、$3$、$5$)。
87139
88140
因此,如果我们所有丑数的有序序列为 $a1,a2,a3,...,an$ 的话,序列中的每一个数都必然能够被以下三个序列(中的至少一个)覆盖:
89141
90-
* 由丑数 * $2$ 所得的有序序列:$1 * 2$、$2 * 2$、$3 * 2$、$4 * 2$、$5 * 2$、$6 * 2$、$8 * 2$ ...
91-
* 由丑数 * $3$ 所得的有序序列:$1 * 3$、$2 * 3$、$3 * 3$、$4 * 3$、$5 * 3$、$6 * 3$、$8 * 3$ ...
92-
* 由丑数 * $5$ 所得的有序序列:$1 * 5$、$2 * 5$、$3 * 5$、$4 * 5$、$5 * 5$、$6 * 5$、$8 * 5$ ...
142+
* 由丑数 $\times 2$ 所得的有序序列:$1 \times 2$、$2 \times 2$、$3 \times 2$、$4 \times 2$、$5 \times 2$、$6 \times 2$、$8 \times 2$ ...
143+
* 由丑数 $ \times 3$ 所得的有序序列:$1 \times 3$、$2 \times 3$、$3 \times 3$、$4 \times 3$、$5 \times 3$、$6 \times 3$、$8 \times 3$ ...
144+
* 由丑数 $\times 5$ 所得的有序序列:$1 \times 5$、$2 \times 5$、$3 \times 5$、$4 \times 5$、$5 \times 5$、$6 \times 5$、$8 \times 5$ ...
93145
94146
举个🌰,假设我们需要求得 $[1, 2, 3, ... , 10, 12]$ 丑数序列 $arr$ 的最后一位,那么该序列可以看作以下三个有序序列归并而来:
95147
96-
* $1 * 2, 2 * 2, 3 * 2, ... , 10 * 2, 12 * 2$ ,将 $2$ 提出,即 $arr * 2$
97-
* $1 * 3, 2 * 3, 3 * 3, ... , 10 * 3, 12 * 3$ ,将 $3$ 提出,即 $arr * 3$
98-
* $1 * 5, 2 * 5, 3 * 5, ... , 10 * 5, 12 * 5$ ,将 $5$ 提出,即 $arr * 5$
148+
* $1 \times 2, 2 \times 2, 3 \times 2, ... , 10 \times 2, 12 \times 2$ ,将 $2$ 提出,即 $arr \times 2$
149+
* $1 \times 3, 2 \times 3, 3 \times 3, ... , 10 \times 3, 12 \times 3$ ,将 $3$ 提出,即 $arr \times 3$
150+
* $1 \times 5, 2 \times 5, 3 \times 5, ... , 10 \times 5, 12 \times 5$ ,将 $5$ 提出,即 $arr \times 5$
99151
100-
因此我们可以使用三个指针来指向目标序列 $arr$ 的某个下标(下标 $0$ 作为哨兵不使用,起始都为 $1$),使用 $arr[下标] * 质因数$ 代表当前使用到三个有序序列中的哪一位,同时使用 $idx$ 表示当前生成到 $arr$ 哪一位丑数。
152+
因此我们可以使用三个指针来指向目标序列 $arr$ 的某个下标(下标 $0$ 作为哨兵不使用,起始都为 $1$),使用 $arr[下标] \times 质因数$ 代表当前使用到三个有序序列中的哪一位,同时使用 $idx$ 表示当前生成到 $arr$ 哪一位丑数。
101153
102-
代码:
103-
```java
154+
Java 代码:
155+
```Java
104156
class Solution {
105157
public int nthUglyNumber(int n) {
106158
// ans 用作存储已有丑数(从下标 1 开始存储,第一个丑数为 1)
@@ -123,6 +175,80 @@ class Solution {
123175
}
124176
}
125177
```
178+
Python 代码:
179+
```Python
180+
class Solution(object):
181+
def nthUglyNumber(self, n):
182+
"""
183+
:type n: int
184+
:rtype: int
185+
"""
186+
# ans 用作存储已有丑数(从下标 1 开始存储,第一个丑数为 1)
187+
ans = [0] * (n+1)
188+
ans[1] = 1
189+
# 由于三个有序序列都是由「已有丑数」*「质因数」而来
190+
# i2、i3 和 i5 分别代表三个有序序列当前使用到哪一位「已有丑数」下标(起始都指向 1)
191+
i2 = i3 = i5 = 1
192+
idx = 2
193+
while idx <= n:
194+
# 由 ans[iX] * X 可得当前有序序列指向哪一位
195+
a,b,c = ans[i2] *2,ans[i3]*3,ans[i5]*5
196+
# 将三个有序序列中的最小一位存入「已有丑数」序列,并将其下标后移
197+
m = min(a,b,c)
198+
# 由于可能不同有序序列之间产生相同丑数,因此只要一样的丑数就跳过(不能使用 else if )
199+
if m == a:
200+
i2 += 1
201+
if m == b:
202+
i3 += 1
203+
if m == c:
204+
i5 += 1
205+
ans[idx] = m
206+
idx += 1
207+
return ans[n]
208+
```
209+
JavaScript 代码:
210+
```JavaScript
211+
/**
212+
* @param {number} n
213+
* @return {number}
214+
*/
215+
var nthUglyNumber = function(n) {
216+
const ans=new Array(n+1);
217+
ans[1]=1;
218+
for(let i2=1, i3=1, i5=1, idx=2;idx<=n;idx++){
219+
let a=ans[i2]*2, b=ans[i3]*3, c=ans[i5]*5;
220+
let min=Math.min(a, b, c);
221+
if(min===a) i2++;
222+
if(min===b) i3++;
223+
if(min===c) i5++;
224+
ans[idx]=min;
225+
}
226+
return ans[n];
227+
};
228+
```
229+
C++ 代码:
230+
```C++
231+
class Solution {
232+
public:
233+
int nthUglyNumber(int n) {
234+
// 存储丑数
235+
int *arr = new int[n + 1];
236+
arr[1] = 1;
237+
238+
for (int x = 1, y = 1, z = 1, index = 2; index <= n; index++){
239+
int a = arr[x] * 2, b = arr[y] * 3, c = arr[z] * 5;
240+
int m = min(a, min(b, c));
241+
if (m == a)x++;
242+
if (m == b)y++;
243+
if (m == c)z++;
244+
arr[index] = m;
245+
}
246+
int ans = arr[n];
247+
delete[] arr;
248+
return ans;
249+
}
250+
};
251+
```
126252
* 时间复杂度:$O(n)$
127253
* 空间复杂度:$O(n)$
128254

LeetCode/41-50/42. 接雨水(困难).md

+8-14
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22

33
这是 LeetCode 上的 **[42. 接雨水](https://leetcode-cn.com/problems/trapping-rain-water/solution/po-su-jie-fa-on2-cha-zhao-you-hua-on-dan-iu44/)** ,难度为 **困难**
44

5-
Tag : 「单调栈」、「数学」
5+
Tag : 「模拟」、「单调栈」、「数学」
66

77

88

99

10-
给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。
11-
12-
10+
给定 `n` 个非负整数表示每个宽度为 `1` 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。
1311

1412
示例 1:
1513

@@ -30,9 +28,9 @@ Tag : 「单调栈」、「数学」
3028
```
3129

3230
提示:
33-
* n == height.length
34-
* 0 <= n <= 3 * $10^4$
35-
* 0 <= height[i] <= $10^5$
31+
* $n = height.length$
32+
* $0 <= n <= 3 * 10^4$
33+
* $0 <= height[i] <= 10^5$
3634

3735
---
3836

@@ -44,10 +42,6 @@ Tag : 「单调栈」、「数学」
4442

4543
同时,边缘的柱子不可能接到雨水(某一侧没有柱子)。
4644

47-
这样的做法属于「暴力做法」,但题目没有给数据范围,我们无法分析到底能否 AC。
48-
49-
唯唯诺诺交一个,过了 ~ (好题,建议加入蓝桥杯
50-
5145
代码:
5246
```Java
5347
class Solution {
@@ -79,7 +73,7 @@ class Solution {
7973

8074
---
8175

82-
### 预处理最值解法
76+
### 预处理最值
8377

8478
朴素解法的思路有了,我们想想怎么优化。
8579

@@ -140,7 +134,7 @@ class Solution {
140134

141135
---
142136

143-
### 单调栈解法
137+
### 单调栈
144138

145139
前面我们讲到,优化思路将问题转化为:**给定一个数组,如何求得任意位置的左半边的最大值和右半边的最大值。**
146140

@@ -192,7 +186,7 @@ class Solution {
192186

193187
---
194188

195-
### 面积差值解法
189+
### 面积差值
196190

197191
事实上,我们还能利用「面积差值」来进行求解。
198192

LeetCode/581-590/581. 最短无序连续子数组(中等).md

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Tag : 「排序」、「双指针」
66

77

88

9-
给你一个整数数组 nums ,你需要找出一个 连续子数组 ,如果对这个子数组进行升序排序,那么整个数组都会变为升序排序。
9+
给你一个整数数组 `nums` ,你需要找出一个 连续子数组 ,如果对这个子数组进行升序排序,那么整个数组都会变为升序排序。
1010

1111
请你找出符合题意的 最短 子数组,并输出它的长度。
1212

@@ -32,10 +32,10 @@ Tag : 「排序」、「双指针」
3232
```
3333

3434
提示:
35-
* 1 <= nums.length <= $10^4$
36-
* -$10^5$ <= nums[i] <= $10^5$
35+
* $1 <= nums.length <= 10^4$
36+
* $-10^5 <= nums[i] <= 10^5$
3737

38-
* 进阶:你可以设计一个时间复杂度为 O(n) 的解决方案吗?
38+
* 进阶:你可以设计一个时间复杂度为 $O(n)$ 的解决方案吗?
3939

4040
---
4141

0 commit comments

Comments
 (0)