题目:

题解:
class Solution:
    def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
        row,col = len(matrix),len(matrix[0])
        row_l,row_r = 0,row-1
        while row_l <= row_r:
            m = (row_l+row_r)//2
            if target < matrix[m][0]:
                row_r = m-1
            elif target > matrix[m][0]:
                row_l = m+1
            elif target == matrix[m][0]:
                return True
        if row_r == 0 and matrix[row_r][0] > target:
            return False
        col_l,col_r = 0,col-1
        while col_l <= col_r:
            m = (col_l+col_r)//2
            if target < matrix[row_r][m]:
                col_r = m-1
            elif target > matrix[row_r][m]:
                col_l = m+1
            elif target == matrix[row_r][m]:
                return True
        return False
                ![[GESP样题 三级] 进制转换、春游、密码合规](https://img-blog.csdnimg.cn/direct/574ea100ebe04ea2a8a0da4d73421dac.png)


















![[C/C++] -- 装饰器模式](https://img-blog.csdnimg.cn/direct/a2bbfe62f94d440999bb4756828f7e06.png)