class Solution(object):
def isToeplitzMatrix(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: bool
"""
len_x = len(matrix)
len_y = len(matrix[0])
for i in range(1,len_x):
for j in range(1,len_y):
if matrix[i-1][j-1] != matrix[i][j]:
return False
return True
Sol = Solution()
print Sol.isToeplitzMatrix([[1,2,3,4],[5,1,2,3],[9,5,1,2]])
0,LC上的一道新的题目
1,很简单,就是遍历整个矩阵,比较元素值而已。