74. 搜索二维矩阵 - 力扣(LeetCode)
class Solution:def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:if not matrix or not matrix[0]:return Falsem, n = len(matrix), len(matrix[0])left, right = 0, m * n - 1while left <= right:mid = left + (right - left) // 2row = mid // ncol = mid % nif matrix[row][col] == target:return Trueelif matrix[row][col] < target:left = mid + 1else:right = mid - 1return False