Let's rotate the array
Problem
Given a square array. Rotate it
90
degrees clockwise. Write the result to the same array, you cannot use an auxiliary array.
Input
One number
n
is entered - the size of the square array (n <=10), and then the array itself with the size
nхn
.
Imprint
Output the resulting array.
Example
# |
Input |
Output |
1 |
3
1 2 3
4 5 6
7 8 9
| 7 4 1
8 5 2
9 6 3
|