LeetCodeDiary

A Diary for solving LeetCode problems

View on GitHub
class Solution:
    def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
        m, n = len(matrix), len(matrix[0])
        column0 = [matrix[i][0] for i in range(m)]
        tx = bisect.bisect([matrix[i][0] for i in range(m)],target)-1
        ty = bisect.bisect(matrix[tx],target)-1
        return matrix[tx][ty] == target

数组 二分查找 中等

到头来二分查找也写不清楚

https://leetcode-cn.com/problems/search-a-2d-matrix/