diff options
author | crupest <crupest@outlook.com> | 2021-02-22 23:52:44 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-02-22 23:52:44 +0800 |
commit | 5276b8b39ae934cf29efdb644efe4fa43994ce0b (patch) | |
tree | 013f94b3898437a17c03b0a1a559c271c67f8778 /cpp/766-2.cpp | |
parent | bd5d833017c06e7d338c957bfaf09df081ea6267 (diff) | |
download | solutions-5276b8b39ae934cf29efdb644efe4fa43994ce0b.tar.gz solutions-5276b8b39ae934cf29efdb644efe4fa43994ce0b.tar.bz2 solutions-5276b8b39ae934cf29efdb644efe4fa43994ce0b.zip |
Add problem 766.
Diffstat (limited to 'cpp/766-2.cpp')
-rw-r--r-- | cpp/766-2.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cpp/766-2.cpp b/cpp/766-2.cpp new file mode 100644 index 0000000..79a0cc8 --- /dev/null +++ b/cpp/766-2.cpp @@ -0,0 +1,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;
+ }
+};
\ No newline at end of file |