#K88387. Rotate Matrix Anti-clockwise

    ID: 37297 Type: Default 1000ms 256MiB

Rotate Matrix Anti-clockwise

Rotate Matrix Anti-clockwise

You are given an N x N matrix. Your task is to rotate the matrix by 90° anti-clockwise (counter-clockwise) in-place.

The operation must be performed in-place, i.e. you should modify the matrix itself without using extra space for another matrix.

Mathematically, if the original matrix is \(A\), then after rotation the element at \(A[i][j]\) moves to \(A[N-j-1][i]\). Perform the transformation and output the resulting matrix.

inputFormat

The first line contains an integer \(N\), the size of the matrix.

The following \(N\) lines each contain \(N\) space-separated integers representing the matrix.

outputFormat

Output the rotated matrix in the same format: \(N\) lines with \(N\) space-separated integers each, representing the matrix after a 90° anti-clockwise rotation.

## sample
3
1 2 3
4 5 6
7 8 9
3 6 9

2 5 8 1 4 7

</p>