MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / searchMatrix

Method searchMatrix

Array/Search2DMatrixII.py:100–119  ·  view source on GitHub ↗
(self, matrix, target)

Source from the content-addressed store, hash-verified

98 return False
99
100 def searchMatrix(self, matrix, target):
101
102 if not any(matrix):
103 return False
104
105 # column + row -
106 column, row = 0, len(matrix) - 1
107 column_length = len(matrix[0])
108
109 while row >= 0 and column < column_length:
110
111 if matrix[row][column] == target:
112 return True
113
114 if matrix[row][column] > target:
115 row -= 1
116 else:
117 column += 1
118
119 return False
120
121 # def searchMatrix(self, matrix, target):
122 # """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected