You are given an n x n 2D matrix, which represents an image.
Your task is to rotate this image by 90 degrees clockwise.
Note that:
matrix directly without allocating another 2D matrix.Do not return anything, instead modify the input matrix
[ [1] ]
[ [1] ]
1
1
[ [1, 2], [3, 4] ]
[ [3, 1], [4, 2] ]
1 2
3 4
3 1
4 2
[ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]
[ [7, 4, 1], [8, 5, 2], [9, 6, 3] ]
1 2 3
4 5 6
7 8 9
7 4 1
8 5 2
9 6 3
[ [1] ]
[ [1] ]