Question bank › Matrix
Dsa Matrix Medium

Matrix Rotation

Rotate a given n x n matrix by 90 degrees clockwise. You need to modify the matrix in place. Input format: - The first line contains an integer 'n', the size of the n x n matrix. - The next 'n' lines contain 'n' space-separated integers. Output format: - Print the rotated matrix, with each row on a new line and elements space-separated. Example: Input: 3 1 2 3 4 5 6 7 8 9 Output: 7 4 1 8 5 2 9 6 3

Key concepts

matrixrotationtransformation

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.