blob: 79a0cc81caf1bb0bd54e454ae7b75272826556ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include <vector>
using std::vector;
class Solution {
public:
bool isToeplitzMatrix(vector<vector<int>> &matrix) {
int row_count = matrix.size();
int col_count = matrix.front().size();
for (int i = 1; i < row_count; i++) {
for (int j = 1; j < col_count; j++) {
if (matrix[i][j] != matrix[i - 1][j - 1])
return false;
}
}
return true;
}
};
|