From dc1f0c4c0096013799416664894c5194dc7e1f52 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Fri, 28 Feb 2025 23:13:39 +0800 Subject: chore(store): move everything to store. --- works/solutions/leetcode/cpp/766.cpp | 44 ------------------------------------ 1 file changed, 44 deletions(-) delete mode 100644 works/solutions/leetcode/cpp/766.cpp (limited to 'works/solutions/leetcode/cpp/766.cpp') diff --git a/works/solutions/leetcode/cpp/766.cpp b/works/solutions/leetcode/cpp/766.cpp deleted file mode 100644 index 3e8a015..0000000 --- a/works/solutions/leetcode/cpp/766.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include - -using std::vector; - -class Solution { -public: - bool isToeplitzMatrix(vector> &matrix) { - int row_count = matrix.size(); - int col_count = matrix.front().size(); - - if (matrix.size() == 1) - return true; - if (matrix.front().size() == 1) - return true; - - // offset = col - row - // max(offset) = row_count - 2 - // min(offset) = -(col_count - 2) - for (int offset = -(col_count - 2); offset <= (row_count - 2); offset++) { - int row, col; - if (offset >= 0) { - row = offset; - col = 0; - } else { - row = 0; - col = -offset; - } - - int value = matrix[row][col]; - row++; - col++; - - while (row < row_count && col < col_count) { - if (matrix[row][col] != value) { - return false; - } - row++; - col++; - } - } - return true; - } -}; -- cgit v1.2.3