solve(matrix) — matrix is an n × n grid. Rotate it **90 degrees clockwise in
place** (do not allocate a second matrix) and return it.
Two cheap in-place steps compose into a rotation: transpose the matrix (swapmatrix[r][c] with matrix[c][r] for c > r), then reverse every row.
Examples
solve([[1,2,3],[4,5,6],[7,8,9]]) → [[7,4,1],[8,5,2],[9,6,3]]
solve([[1,2],[3,4]]) → [[3,1],[4,2]]
solve([[1]]) → [[1]]Sample tests