Description
A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element. Now given an M x N matrix, return True if and only if the matrix is Toeplitz.
Example
1 | Input: |
1 | Input: |
Idea
直接遍历,不过是要check遍历元素和斜对的元素是不是一样
Code
1 | class Solution(object): |