problem
solution1:
class Solution { public: bool isToeplitzMatrix(vector<vector<int>>& matrix) { for(int i=0; i<matrix.size()-1; ++i) { for(int j=0; j<matrix[0].size()-1; ++j) { if(matrix[i][j] != matrix[i+1][j+1]) return false; } } return true; } };
参考
1. Leetcode_easy_766. Toeplitz Matrix;
2. Grandyang;
完
原文地址:https://www.cnblogs.com/happyamyhope/p/11202577.html
时间: 2024-11-01 18:06:22