题解 | 矩阵查找
矩阵查找
https://www.nowcoder.com/practice/5145394607ea4c5f8b25755718bfddba
class Solution:
def searchMatrix(self , matrix , target ):
# write code here
rows = 0
arr = len(matrix[0])-1
while rows<=len(matrix)-1 and arr>=0:
if(matrix[rows][arr]==target):
return True
elif(matrix[rows][arr]>target):
arr-=1
elif(matrix[rows][arr]<target):
rows+=1
return False
