New update is available. Click here to update.

Last Updated: 16 Dec, 2020

Difficulty: Easy

```
For given 2D array :
[ [ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ] ]
After 90 degree rotation in anti clockwise direction, it will become:
[ [ 3, 6, 9 ],
[ 2, 5, 8 ],
[ 1, 4, 7 ] ]
```

```
The first line of input contains an integer 'T' representing the number of the test case. Then the test case follows.
The first line of each test case contains an integer 'N' representing the size of the square matrix 'ARR'.
Each of the next 'N' lines contains 'N' space-separated integers representing the elements of the matrix 'ARR'.
```

```
For each test case, print N lines where N is the size of the matrix, containing N space-separated integer denoting the elements of the matrix after rotation.
The output of each 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 ≤ 50
1 ≤ N ≤ 100
1 ≤ MATRIX[i][j] ≤ 10 ^ 5
Time Limit: 1 sec.
```

SIMILAR PROBLEMS

Merge Two Sorted Arrays Without Extra Space

Posted: 19 Nov, 2022

Difficulty: Moderate

Search In A Sorted 2D Matrix

Posted: 23 Nov, 2022

Difficulty: Moderate

Spiral Matrix

Posted: 24 Nov, 2022

Difficulty: Easy

Ninja And The Strictly Increasing Array

Posted: 27 Nov, 2022

Difficulty: Moderate

Negative To The End

Posted: 16 Dec, 2022

Difficulty: Easy

Popular Interview Problems: