root@coding-prodigies:~#
← All challenges

Matrix Rotation

Rotate a 3x3 grid of numbers 90 degrees clockwise, in place.

🔴 ExtremeDifficulty

The challenge

Given the matrix [[1,2,3],[4,5,6],[7,8,9]], rotate it 90 degrees clockwise and print each row of the result on its own line, space-separated.

Output

  
🧠 Need a hint? (Python)

For an n x n matrix, rotated[j][n-1-i] = mat[i][j] for every i, j -- build a new n x n grid and fill it with that mapping.

🚀

Like solving these?

Structured courses, hands-on exercises, and real multi-file projects are waiting -- your first project unlock is free.

Create a free account

More challenges