leetcode 766Toeplitz MatrixPython

xiaoxiao2025-04-28  27

三年前刷过leetcode,今天开始决定闲来无事继续刷着玩,并且把答案传一下博客~问题描述就不写了,贴一下链接吧

https://leetcode.com/problems/toeplitz-matrix/

class Solution(object): def isToeplitzMatrix(self, matrix): """ :type matrix: List[List[int]] :rtype: bool """ if not matrix: return True m = len(matrix) n = len(matrix[0]) for i in range(m-1): for j in range(n-1): if matrix[i][j]!=matrix[i+1][j+1]: return False return True

 

转载请注明原文地址: https://www.6miu.com/read-5029326.html

最新回复(0)