#C13320. Matrix Rotation: 90° Clockwise
Matrix Rotation: 90° Clockwise
Matrix Rotation: 90° Clockwise
You are given an n x n matrix. Your task is to rotate the matrix by 90° clockwise in-place. The rotation must be performed without using extra space for another matrix.
The problem requires you to read the matrix from the standard input, perform the rotation, and then output the rotated matrix to standard output.
Note: The matrix is guaranteed to be square.
Mathematical Formulation: If the original matrix is \(A\) where \(A = [a_{ij}]\) with \(0 \le i, j < n\), after the rotation, the element at \(A[i][j]\) moves to \(A[j][n-1-i]\).
inputFormat
The first line of input contains an integer \(n\) representing the size of the matrix.
The next \(n\) lines each contain \(n\) space-separated integers representing the matrix rows.
outputFormat
Output the rotated matrix in \(n\) lines. Each line should contain \(n\) space-separated integers representing the rotated row of the matrix.
## sample2
1 2
3 4
3 1
4 2
</p>