From bc055241a34ad8310962941aa01862f37b11c8be Mon Sep 17 00:00:00 2001 From: Kim Hyuna Date: Sun, 22 May 2022 02:38:47 +0900 Subject: [PATCH] [LeetCode] 766 --- .../766.cpp" | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 "\352\271\200\355\230\204\354\225\204/766.cpp" 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