Check if a matrix is a Toeplitz matrix You will be given a two-dimensional array and a number and you are asked to find whether the given matrix is Toeplitz or not.

Input Format:

You will be given a function which will take two-dimensional matrix as argument.

Output Format:

Return 1 from the function if the matrix is Toeplitz, else return -1.

Constraints:

3 &lt; n,m &lt; 10,000,000


where n is the number of rows while m will be the number of columns.

Sample Test Case:

Sample Input :
4 
5
6 7 8 9 2
4 6 7 8 9
1 4 6 7 8
0 1 4 6 7 

Sample Output : 
1 


Scoring

This is code-golf, so the shortest answer in bytes wins.
Mathematica, 42 bytes

2Boole[#==ToeplitzMatrix[#&amp;@@@#,#&amp;@@#]]-1&amp;


Mathematica doesn't have a built-in to check whether something is a Toeplitz matrix, but it does have a built-in to generate one. So we generate one from the first column (#&amp;@@@#) and the first row (#&amp;@@#) of the input and check whether it's equal to the input. To convert the True/False result to 1/-1 we use Boole (to give 1 or 0) and then simply transform the result with 2x-1.