[Python3] Search a 2D Matrix O(m+n)
\n\nclass Solution:\n    def searchMatrix(self, matrix, target):\n        """\n        :type matrix: List[List[int]]\n        :type target: int\n        :rtype:
\n```\nclass Solution:\n    def searchMatrix(self, matrix, target):\n        """\n        :type matrix: List[List[int]]\n        :type target: int\n        :rtype: bool\n        """\n        if len(matrix) == 0: return False\n        # we initialize the pointer at the bottom-left of the matrix\n        r,c = len(matrix)-1,0\n        while r >=0 and c <len(matrix[0]):\n            if matrix[r][c] == target:\n                return True\n            else:\n                if matrix[r][c] < target:\n                    c += 1\n                else:\n                    r -= 1\n        return False\n```\n* Time complexity: O(m+n)\n\tm is the number of rows, and n is the number of columns.\n    The worst-case here is that the algorithm needs to finish scan one row and one column.\n* Space complexity: O(1)\n    The algorithm only needs four integers : row, col, height, width, so the space complexity is constant.
['Python', 'Python3']