Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding
Ninjas X Naukri.com

Last Updated: 17 Oct, 2020

Easy

```
The first line contains an Integer 'T' which denotes the number of test cases or queries to be run. Then the test cases follow.
The first line of each test case contains the size of the square matrix 'N'.
The second line of each test case contains the 'N' * 'N' Integers separated by a single space (the matrix is entered row-wise)
```

```
For each test case/query, print whether the given matrix is symmetric or not.
Output for every test case will be printed in a separate line.
```

```
You do not need to print anything, it has already been taken care of. Just implement the given function.
```

```
1 <= T <= 10
1 <= N <= 10^2
-10^9 <= data <= 10^9
Where 'data' denotes the element in the given 'matrix'.
Time Limit: 1 sec
```

- Create another matrix ‘TRANSPOSE’ of the same size initially having all zeros.
- Now replace ‘TRANSPOSE’ (i,j) with ‘MATRIX’ (j,i).
- And now traverse both matrixes element by element if anywhere there is inequality return false, else continue.
- In the end, return true as you traverse.

- Traverse the matrix element by element and compare ‘MATRIX' ( I, j) with 'MATRIX" ( j, i).
- And if anywhere there inequality exists between them simply return false from that point else continue.
- In the end, if not returned previously from anywhere else just return true, as ‘MATRIX’ is symmetric.

Similar problems

SudoKube

Ninja

Posted: 18 May, 2022

SudoKube

Ninja

Posted: 18 May, 2022

SudoKube

Ninja

Posted: 18 May, 2022

SudoKube

Ninja

Posted: 18 May, 2022

SudoKube

Ninja

Posted: 18 May, 2022

SudoKube

Ninja

Posted: 18 May, 2022

SudoKube

Ninja

Posted: 18 May, 2022

SudoKube

Ninja

Posted: 18 May, 2022

King Placement

Moderate

Posted: 22 May, 2022

Ninja and the experiment

Moderate

Posted: 5 Sep, 2022

Search In A Sorted 2D Matrix

Moderate

Posted: 23 Nov, 2022

Spiral Matrix

Easy

Posted: 24 Nov, 2022

Spiral Matrix

Easy

Posted: 24 Nov, 2022