mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-05 00:25:22 +08:00
14 lines
256 B
Go
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
|
|
}
|