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

京公网安备 11010502036488号