Community

Start a Thread


Notifications
Subscribe You’re not receiving notifications from this thread.

Toeplitz Matrix (Main Thread)

Here is the interview question prompt, presented for reference.

A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same elements.

Given an m x n matrix, return true if the matrix is Toeplitz. Otherwise, return false.

![image](https://storage.googleapis.com/algodailyrandomassets/curriculum/arrays/toeplitz-matrix/problem.png)

For example, consider the matrices above. The first matrix has all its diagonals filled with the same elements, whereas the second matrix has only two diagonals with the same elements. Having even a single diagonal with different elements would not make the matrix, a Toeplitz matrix.

Constraints

  • m == matrix.length
  • n == matrix[i].length
  • 1 <= m, n <= 20
  • 0 <= matrix[i][j] <= 99

You can see the full challenge with visuals at this link.

Challenges • Asked over 2 years ago by Jake from AlgoDaily

Jake from AlgoDaily Commented on Aug 13, 2022:

This is the main discussion thread generated for Toeplitz Matrix (Main Thread).