Skip to content

Commit e7088d1

Browse files
committed
add search a 2d matrix
1 parent a0cc165 commit e7088d1

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Search a 2D Matrix(搜索二维矩阵)
2+
LeetCode 74
3+
[English](https://leetcode.com/problems/search-a-2d-matrix/)
4+
[中文](https://leetcode-cn.com/problems/search-a-2d-matrix/)
5+
6+
## 题目
7+
编写一个高效的算法来判断 m x n 矩阵中,是否存在一个目标值。该矩阵具有如下特性:
8+
9+
每行中的整数从左到右按升序排列。
10+
每行的第一个整数大于前一行的最后一个整数。
11+
示例 1:
12+
```
13+
输入:
14+
matrix = [
15+
[1, 3, 5, 7],
16+
[10, 11, 16, 20],
17+
[23, 30, 34, 50]
18+
]
19+
target = 3
20+
输出: true
21+
```
22+
示例 2:
23+
```
24+
输入:
25+
matrix = [
26+
[1, 3, 5, 7],
27+
[10, 11, 16, 20],
28+
[23, 30, 34, 50]
29+
]
30+
target = 13
31+
输出: false
32+
```
33+
## 思路
34+
<details>
35+
<summary>点击展开</summary>
36+
// TODO
37+
</details>
38+
39+
## 代码实现
40+
| C | C++ | Java | Objective-C | Swift | Python | JavaScript | Go | PHP |
41+
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: |
42+
| 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 | 🤔 |
43+

0 commit comments

Comments
 (0)