Symmetric Matrix Check

Given a nonempty rectangular integer matrix, return true exactly when it is square and every entry at row r, column c equals the entry at row c, column r.…

Given a nonempty rectangular integer matrix, return true exactly when it is square and every entry at row r, column c equals the entry at row c, column r. Return false for every valid rectangular matrix that is not square.

1 to 1000 rows, 1 to 500 columns, at most 250,000 cells; every row has the same positive length. Every cell is a signed 32-bit integer. The visualizer uses matrices of at most 6 rows and 6 columns; larger valid inputs are execution-only.

Example 1: input matrix = [[7]]; output true. A one-cell matrix is square and its only transposed pair is itself.

Example 2: input matrix = [[1, 2], [2, 3]]; output true. The two off-diagonal entries match, so every transposed pair is equal.

Example 3: input matrix = [[-4, 6], [6, -4]]; output true. Negative values are compared normally, and the off-diagonal entries match.

Category: Arrays. Topic: arrays. Difficulty: Easy. Patterns: math.