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

Method binarySearch2

Array/Search2DMatrix.py:81–102  ·  view source on GitHub ↗
(self, rawList, target)

Source from the content-addressed store, hash-verified

79 return self.binarySearch(rightList, target, index=index+len(leftList))
80
81 def binarySearch2(self, rawList, target):
82 split = len(rawList) // 2
83
84 left = rawList[:split]
85 right = rawList[split:]
86
87 if not left and not right:
88 return False
89
90 if left and left[-1] == target:
91 return True
92
93 if right and right[0] == target:
94 return True
95
96 if len(left) > 1 and left[-1] > target:
97 return self.binarySearch2(left, target)
98
99 if len(right) > 1 and right[0] < target:
100 return self.binarySearch2(right, target)
101
102 return False
103
104 def searchMatrix(self, matrix, target):
105 """

Callers 1

searchMatrixMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected