matrix rotation by 90 degrees

Опубликовано: 09 Июль 2026
на канале: OlaKunle Babatunde
520
8

Given an image represented by NxN matrix, where each pixel is 4 bytes, rotate the image by 90 degrees.

-------------------algorithm-------------------
1. transpose the matrix
rows to columns or vice versa
0 1 3 0 2 5
2 -4 9 to 1 -4 9
5 9 2 3 9 2

2. reverse each row

5 2 0
9 -4 1
2 9 3

SUBSCRIBE HERE FOR MORE -    / @kunlebcoder