Here’s the clean summary β€” no code, just concepts:


πŸ” Transpose

  • Swap matrix[r][c] with matrix[c][r]

  • Reflects matrix across the main diagonal

  • Rows become columns


πŸ”„ Row Reverse

  • Reverse elements inside each row

  • Flips matrix left ↔ right

  • Horizontal flip


πŸ”„ Column Reverse

  • Reverse elements inside each column

  • Flips matrix top ↔ bottom

  • Vertical flip


πŸ”„ Rotations (NxN Matrix)

βœ… 90Β° Clockwise

  • Transpose

  • Then reverse each row


βœ… 180Β°

  • Reverse rows (top ↔ bottom)

  • Then reverse each row

  • Order does not matter


βœ… 270Β° Clockwise (same as 90Β° CCW)

  • Transpose

  • Then reverse each column


🧠 Mental Shortcut

  • Transpose = diagonal flip

  • Row reverse = horizontal flip

  • Column reverse = vertical flip

  • Combine flips to get rotation

That’s the whole rotate-matrix game.