136. Rotate the Panel
Medium
A panel is represented by a square matrix of numbers. Rotate the panel 90 degrees clockwise and return the resulting matrix.
The parameter matriz contains the matrix to rotate. You may modify its elements while processing it.
Example 1
Input: matriz = [[1, 2], [3, 4]]
Output: [[3, 1], [4, 2]]
Explanation: The original first row becomes the last column.
Example 2
Input: matriz = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Output: [[7, 4, 1], [8, 5, 2], [9, 6, 3]]
Explanation: Each original column becomes a row, read from bottom to top.
Constraints
- 1 <= matriz.length <= 1000
- matriz.length == matriz[i].length
- -10^9 <= matriz[i][j] <= 10^9
MatrixMath
Saved in this browser
Caso 1
matriz =
[[1,2],[3,4]]
Expected =
[[3,1],[4,2]]
Caso 2
matriz =
[[1,2,3],[4,5,6],[7,8,9]]
Expected =
[[7,4,1],[8,5,2],[9,6,3]]
Run checks these 2 cases. Submit runs all 10, including hidden ones.