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.
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...
Top Josh Technology Group Software Engineer interview questions & answers
Popular interview questions of Software Engineer
>
Josh Technology Group Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
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
Get AmbitionBox app