Dsa
Matrix
Hard
Rotate Matrix 90 Degrees
Given an n x n matrix, rotate the matrix by 90 degrees clockwise in-place.
Example:
Input:
1 2 3
4 5 6
7 8 9
Output:
7 4 1
8 5 2
9 6 3
Key concepts
matrixrotation
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now