```
def searchMatrix(self, matrix, target):
low = 0
m = len(matrix)
n = len(matrix[0])
high = m * n - 1
mid = (low + high) / 2
while (low < high - 1):
mid = (low + high) / 2
if target < matrix[mid / n][mid % n]:
high = mid
elif target > matrix[mid / n][mid % n]:
low = mid
else:
return True
return target == matrix[low / n][low % n] or target == matrix[high / n][high % n]
```