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 d40cc0e

Browse files
✨feat: Add 448
1 parent 04eeabe commit d40cc0e

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

‎Index/原地哈希.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
| 题目 | 题解 | 难度 | 推荐指数 |
22
| ------------------------------------------------------------ | ------------------------------------------------------------ | ---- | -------- |
33
| [442. 数组中重复的数据](https://leetcode-cn.com/problems/find-all-duplicates-in-an-array/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/find-all-duplicates-in-an-array/solution/by-ac_oier-0m3c/) | 中等 | 🤩🤩🤩🤩🤩 |
4+
| [448. 找到所有数组中消失的数字](https://leetcode-cn.com/problems/find-all-numbers-disappeared-in-an-array/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/find-all-numbers-disappeared-in-an-array/solution/li-yong-tong-pai-xu-de-si-lu-ni-huan-ke-e3t4w/) | 简单 | 🤩🤩🤩🤩🤩 |
45

‎LeetCode/441-450/448. 找到所有数组中消失的数字(简单).md‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
这是 LeetCode 上的 **[448. 找到所有数组中消失的数字](https://leetcode-cn.com/problems/find-all-numbers-disappeared-in-an-array/solution/li-yong-tong-pai-xu-de-si-lu-ni-huan-ke-e3t4w/)** ,难度为 **简单**
44

5-
Tag : 「排序」
5+
Tag : 「排序」、「原地哈希」
66

77

88

9-
给定一个范围在 1 ≤ a[i] ≤ n ( n = 数组大小 ) 的 整型数组,数组中的元素一些出现了两次,另一些只出现一次。
9+
给定一个范围在 $1 ≤ a[i] ≤ n$ ( $n$ = 数组大小 ) 的 整型数组,数组中的元素一些出现了两次,另一些只出现一次。
1010

11-
找到所有在 [1, n] 范围之间没有出现在数组中的数字。
11+
找到所有在 $[1, n]$ 范围之间没有出现在数组中的数字。
1212

13-
您能在不使用额外空间且时间复杂度为O(n)的情况下完成这个任务吗? 你可以假定返回的数组不算在额外空间内。
13+
您能在不使用额外空间且时间复杂度为 $O(n)$ 的情况下完成这个任务吗? 你可以假定返回的数组不算在额外空间内。
1414

1515
示例:
1616
```
@@ -23,19 +23,20 @@ Tag : 「排序」
2323

2424
---
2525

26-
### 桶排序
26+
### 桶排序(原地哈希)
2727

28-
题目规定了 `1 ≤ a[i] ≤ n`,因此我们可以使用「桶排序」的思路,将每个数放在其应该出现的位置上。
28+
题目规定了 $1 ≤ a[i] ≤ n$,因此我们可以使用「桶排序」的思路,将每个数放在其应该出现的位置上。
2929

3030
基本思路为:
3131

32-
按照桶排序思路进行预处理:保证 1 出现在 nums[0] 的位置上,2 出现在 nums[1] 的位置上,...,n 出现在 nums[n - 1] 的位置上。不在 [1, n] 范围内的数不用动。
32+
按照桶排序思路进行预处理:保证 1ドル$ 出现在 $nums[0]$ 的位置上,2ドル$ 出现在 $nums[1]$ 的位置上,...,$n$ 出现在 $nums[n - 1]$ 的位置上。不在 $[1, n]$ 范围内的数不用动。
3333

34-
例如样例中 [4,3,2,7,8,2,3,1] 将会被预处理成 [1,2,3,4,3,2,7,8]
34+
例如样例中 $[4,3,2,7,8,2,3,1]$ 将会被预处理成 $[1,2,3,4,3,2,7,8]$
3535

36-
遍历 nums,将不符合 `nums[i] != i + 1` 的数字加入结果集 ~
36+
遍历 $nums$,将不符合 `nums[i] != i + 1` 的数字加入结果集 ~
3737

38-
```java
38+
代码:
39+
```Java
3940
class Solution {
4041
public List<Integer> findDisappearedNumbers(int[] nums) {
4142
int n = nums.length;
@@ -62,7 +63,7 @@ class Solution {
6263

6364
### 最后
6465

65-
这是我们「刷穿 LeetCode」系列文章的第 `No.448` 篇,系列开始于 2021年01月01日,截止于起始日 LeetCode 上共有 1916 道题目,部分是有锁题,我们将先将所有不带锁的题目刷完
66+
这是我们「刷穿 LeetCode」系列文章的第 `No.448` 篇,系列开始于 2021年01月01日,截止于起始日 LeetCode 上共有 1916 道题目,部分是有锁题,我们将先把所有不带锁的题目刷完
6667

6768
在这个系列文章里面,除了讲解解题思路以外,还会尽可能给出最为简洁的代码。如果涉及通解还会相应的代码模板。
6869

0 commit comments

Comments
(0)

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