Files
LeetCode-Go/Algorithms/0766. Toeplitz Matrix/766. Toeplitz Matrix.go
2019-08-10 14:50:03 +08:00

14 lines
256 B
Go

package leetcode
func isToeplitzMatrix(matrix [][]int) bool {
rows, columns := len(matrix), len(matrix[0])
for i := 1; i < rows; i++ {
for j := 1; j < columns; j++ {
if matrix[i-1][j-1] != matrix[i][j] {
return false
}
}
}
return true
}