Skip to content

Commit 6a65060

Browse files
committed
Adding readme file
1 parent c1f9c19 commit 6a65060

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

766-ToeplitzMatrix/README.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Given an m x n matrix, return true if the matrix is Toeplitz. Otherwise, return false.
2+
3+
A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same elements.
4+
5+
 
6+
Example 1:
7+
8+
Input: matrix = [[1,2,3,4],[5,1,2,3],[9,5,1,2]]
9+
Output: true
10+
Explanation:
11+
In the above grid, the diagonals are:
12+
"[9]", "[5, 5]", "[1, 1, 1]", "[2, 2, 2]", "[3, 3]", "[4]".
13+
In each diagonal all elements are the same, so the answer is True.
14+
15+
16+
Example 2:
17+
18+
Input: matrix = [[1,2],[2,2]]
19+
Output: false
20+
Explanation:
21+
The diagonal "[1, 2]" has different elements.
22+
23+
24+
 
25+
Constraints:
26+
27+
28+
m == matrix.length
29+
n == matrix[i].length
30+
1 <= m, n <= 20
31+
0 <= matrix[i][j] <= 99
32+
33+
34+
 
35+
Follow up:
36+
37+
38+
What if the matrix is stored on disk, and the memory is limited such that you can only load at most one row of the matrix into the memory at once?
39+
What if the matrix is so large that you can only load up a partial row into the memory at once?
40+

0 commit comments

Comments
 (0)