563. Matrix Rotation
Given a 2D matrix of size n x n, rotate the matrix 90 degrees clockwise. The rotation must be done in-place, meaning the original matrix should be modified directly. Another 2D matrix should not be allocated for the rotation.
The first line contains the number of rows in the matrix. The second line contains the number of columns in the matrix. The third line contains the elements of the matrix.
Print the modified matrix.
3 3 1 2 3 4 5 6 7 8 9
7 4 1 8 5 2 9 6 3
n is equal to the length of the matrix and the length of each row in the matrix. The value of n must be between 1 and 20, inclusive. The values in the matrix must be between -1000 and 1000, inclusive.