766. Toeplitz Matrix
题目描述
A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element.
Now given an M x N matrix, return True if and only if the matrix is Toeplitz.
Example 1:
|
|
Example 2:
|
|
Note:
- matrix will be a 2D array of integers.
- matrix will have a number of rows and columns in range [1, 20].
- matrix[i][j] will be integers in range [0, 99].
题目大意
求证此矩阵是否是常对角矩阵
解题思路
按照矩阵要求遍历即可。
代码
|
|