Files
LeetCode-Go/leetcode/0766.Toeplitz-Matrix/766. Toeplitz Matrix.go
2020-08-07 17:06:53 +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
}