Skip to content

Commit 0c3fc94

Browse files
committed
add 01 matrix
1 parent 45c447b commit 0c3fc94

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

Search/07.01Matrix/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# 01 Matrix(01 矩阵)
2+
3+
LeetCode 542
4+
5+
- [英文版](https://leetcode.com/problems/01-matrix/)
6+
7+
- [中文版](https://leetcode.com/problems/01-matrix/)
8+
9+
## 题目
10+
给定一个由 0 和 1 组成的矩阵,找出每个元素到最近的 0 的距离。
11+
12+
两个相邻元素间的距离为 1 。
13+
14+
示例 1:
15+
```
16+
输入:
17+
18+
0 0 0
19+
0 1 0
20+
0 0 0
21+
输出:
22+
23+
0 0 0
24+
0 1 0
25+
0 0 0
26+
```
27+
28+
示例 2:
29+
```
30+
输入:
31+
32+
0 0 0
33+
0 1 0
34+
1 1 1
35+
输出:
36+
37+
0 0 0
38+
0 1 0
39+
1 2 1
40+
```
41+
42+
注意:
43+
44+
1. 给定矩阵的元素个数不超过 10000。
45+
2. 给定矩阵中至少有一个元素是 0。
46+
3. 矩阵中的元素只在四个方向上相邻: 上、下、左、右。
47+
48+
## 思路
49+
<details>
50+
<summary>点击展开</summary>
51+
// TODO
52+
</details>
53+
54+
## 代码实现
55+
| C | C++ | Java | Objective-C | Swift | Python | JavaScript | Go | PHP |
56+
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
57+
| 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 |
58+

Search/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@
1111
[05. Search in Rotated Sorted Array(搜索旋转排序数组)](./05.SearchInRotatedArray)
1212

1313
[06. Search a 2D Matrix(搜索二维矩阵)](./06.SearchA2DMatrix)
14+
15+
[07. Matrix(01 矩阵)](./07.01Matrix)

0 commit comments

Comments
 (0)