Coding Challenge

Rotate Image

Medium
matrix

Rotate an n x n matrix 90 degrees clockwise in place.

Modify the square matrix in place so it becomes rotated 90 degrees clockwise.

Examples

Input: matrix = [[1,2,3],[4,5,6],[7,8,9]]

Output: [[7,4,1],[8,5,2],[9,6,3]]

Constraints

  • Matrix is square
  • In-place rotation required

Preparing your coding workspace...