365. Check if a matrix is a Toeplitz matrix
Determine whether a given
M x N matrix is a Toeplitz matrix. A Toeplitz matrix, also known as a diagonal-constant matrix, is a matrix in which each descending diagonal from left to right is constant.
Mat of size
N x M is considered a Toeplitz matrix if
Mat(i, j) = Mat(i+1, j+1) = Mat(i+2, j+2) and so on. Here,
Mat(i, j) refers to the element
Mat[i][j] in the matrix.
For example, the following matrix is a Toeplitz matrix:
Nrepresenting the number of rows and columns in the matrix.
N x Nintegers representing the elements of the square matrix.