Matrix Symmetry Check

You are provided with a square matrix. Your task is to return true if the matrix is symmetric; otherwise, return false.

A symmetric matrix is characterized by its transpose being equal to the matrix itself.

Example of Symmetric Matrix:

Please refer to the example image below.

Symmetric Example

Input:

The first line contains an integer 'T', the number of test cases or queries to be executed. 
Each test case starts with an integer 'N', representing the size of the square matrix.
The following line contains 'N' * 'N' integers, representing the matrix in a row-wise manner.

Output:

For each test case/query, output true if the matrix is symmetric; otherwise, output false. 
Each result should be printed on a new line.

Constraints:

  • 1 <= T <= 10
  • 1 <= N <= 10^2
  • -10^9 <= data <= 10^9
Note:
The 'data' refers to individual elements within the matrix.
The function implementation should avoid print statements; output handling is pre-configured.
Time Limit: 1 second
Be the first one to answer
Add answer anonymously...
Josh Technology Group Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter