48. Rotate Image
Intuition
To rotate an image (matrix) 90 degrees clockwise in-place, we can break it down into two simple transformations:
Transpose the matrix: convert rows to columns by flipping over the diagonal.
Reverse each row (mirror along the vertical center axis).
These two operations combined result in a 90° clockwise rotation without using extra space.
Complexity
Space Complexity
Time Complexity
Code
Last updated