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

Method searchMatrix

Array/Search2DMatrix.py:104–119  ·  view source on GitHub ↗

:type matrix: List[List[int]] :type target: int :rtype: bool

(self, matrix, target)

Source from the content-addressed store, hash-verified

102 return False
103
104 def searchMatrix(self, matrix, target):
105 """
106 :type matrix: List[List[int]]
107 :type target: int
108 :rtype: bool
109 """
110 if not any(matrix):
111 return False
112
113 column = [i[0] for i in matrix]
114
115 column_result = self.binarySearch(column, target)
116 if column_result == -1:
117 return False
118
119 return self.binarySearch2(matrix[column_result], target)

Callers

nothing calls this directly

Calls 2

binarySearchMethod · 0.95
binarySearch2Method · 0.95

Tested by

no test coverage detected