Solved LeetCode program · 48 of 1,000
#0048 · Rotate Image
Original English source
The matrix is a list of 1, 2, 3, 4, 5, 6, 7, 8, and 9. The size is 3. The last is size minus 1.
For every row from 0 to last.
For every column from row to last.
Swap item (row times size plus column) of matrix and item (column times size plus row) of matrix.
For every row from 0 to last.
For every column from 0 to 1.
The mirror is last minus column. Swap item (row times size plus column) of matrix and item (row times size plus mirror) of matrix.
For each value in matrix, show value.
Expected stdout
7 4 1 8 5 2 9 6 3