Matrix rotation - MarisaOJ: Marisa Online Judge

Matrix rotation

Time limit: 1000 ms
Memory limit: 256 MB
Given a matrix of size $n \times n$ consisting of integers. Rotate it 90 degrees clockwise in place. ### Input - The first line contains an integer n. - The next $n$ lines, each line contains $n$ integers representing the matrix. ### Output - Print the given matrix after rotating. ### Constraints - $1 \le n \le 50$. - $1 \le A_i \le 100$ ### Example Input: ``` 3 1 2 3 4 5 6 7 8 9 ``` Output: ``` 7 4 1 8 5 2 9 6 3 ```