Toeplitz Matrix Check Problem
Toeplitz Matrix Check Problem — ExecCode Easy DSA Practice
Solve the Toeplitz Matrix Check problem on ExecCode. Free online easy DSA practice in Matrix. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given an m x n matrix, return true if the matrix is Toeplitz. Your task is to otherwise, return false. A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same elements.
Examples
Input {"matrix": [[6, 7, 8], [4, 6, 7], [1, 4, 6]]}; Output True. Input {"matrix": [[1, 2, 3, 4], [5, 1, 2, 3], [9, 5, 1, 2]]}; Output True. Input {"matrix": [[1, 2, 3, 4], [5, 1, 2, 3], [9, 4, 1, 2]]}; Output False
Constraints
m == matrix.length n == matrix[i].length 1 <= m, n <= 20 0 <= matrix[i][j] <= 99
Practice Toeplitz Matrix Check free on ExecCode. Browse DSA problems, topic map, and placement guides.