Toeplitz Matrix
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
A matrix is called a **Toeplitz matrix** if every diagonal that runs from the top-left toward the bottom-right contains the same value in all of its cells.
Concretely, for any cell matrix[r][c] that has a cell directly above and to its left (its top-left neighbor matrix[r-1][c-1]), the two values must be equal.
Given an m x n integer grid matrix, return true if the matrix is Toeplitz, and false otherwise.
Examples
Constraints
- `m == matrix.length`
- `n == matrix[0].length`
- `1 <= m, n <= 20`
- `0 <= matrix[r][c] <= 99`
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.