We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4fc64ad commit e6db441Copy full SHA for e6db441
P112. 搜索二维矩阵.md
@@ -0,0 +1,24 @@
1
+
2
+
3
+```
4
+class Solution(object):
5
+ def searchMatrix(self, matrix, target):
6
+ """
7
+ :type matrix: List[List[int]]
8
+ :type target: int
9
+ :rtype: bool
10
11
12
+ row = len(matrix)-1
13
+ col = 0
14
+ start = matrix[row][col]
15
16
+ while (row>=0 and col < len(matrix[0])):
17
+ if matrix[row][col] < target:
18
+ col += 1
19
+ elif matrix[row][col] > target:
20
+ row -= 1
21
+ else:
22
+ return True
23
+ return False
24
images/algo48.jpg
46.3 KB
0 commit comments