Back to course home
0% completed
Vote For New Content
Rotate Image (medium)
Problem Statement
Given an n x n
2D matrix, modify a square matrix by rotating
it 90 degrees
in a clockwise
direction.
Note: This rotation should be done in-place
, meaning the transformation must occur within the original matrix without using any additional space for another matrix.
Examples
- Example 1:
- Input: matrix =
[[1,2],
[3,4]]
- Expected Output:
[[3,1],
[4,2]]
.....
.....
.....
Like the course? Get enrolled and start learning!
On this page