diff --git "a/\352\271\200\355\230\204\354\225\204/766.cpp" "b/\352\271\200\355\230\204\354\225\204/766.cpp" new file mode 100644 index 0000000..499b297 --- /dev/null +++ "b/\352\271\200\355\230\204\354\225\204/766.cpp" @@ -0,0 +1,20 @@ +//220522 +//LeetCode 766. Toeplitz Matrix (Easy) +//https://leetcode.com/problems/toeplitz-matrix/ + +class Solution { +public: + bool isToeplitzMatrix(vector>& matrix) { + int m = matrix.size(); + int n = matrix[0].size(); + + for (int i = 1; i < m; i++) { + for (int j = 1; j < n; j++) { + if (matrix[i - 1][j - 1] != matrix[i][j]) { + return false; + } + } + } + return true; + } +}; \ No newline at end of file