You are given a square grid of numbers matrix with n rows and n columns. It is like a picture. Turn the picture by 90 degrees clockwise.
Do it in place. That means you must change the given matrix itself. Do not make a second matrix for the answer.
Examples
Example 1:
Input: matrix = [[5,6],[7,8]]
Output: [[7,5],[8,6]]
Explanation: The left column [5,7] becomes the top row, read from bottom to top: [7,5].
Example 2:
Input: matrix = [[2,4,6],[8,10,12],[14,16,18]]
Output: [[14,8,2],[16,10,4],[18,12,6]]
Explanation: The first column, from bottom to top, becomes the first row.
Example 3:
Input: matrix = [[7]]
Output: [[7]]
Explanation: One number stays as it is.