The idea is quite easy, iterate all index and check the value of up-left position.
(i - 1, j - 1)
\
(i, j)
fun isToeplitzMatrix(matrix: Array<IntArray>): Boolean {
val m = matrix.size
val n = matrix[0].size
for (i in 0 until m) {
for (j in 0 until n) {
if (i - 1 >= 0 && j - 1 >= 0 && matrix[i - 1][j - 1] != matrix[i][j]) return false
}
}
return true
}