CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
[CHALLENGE] Matrix Rotation
The task is. You have a Matrix NxN. You should rotate it on 90 degrees.
Example:
N = 3
Input:
1 2 3
4 5 6
7 8 9
Output:
7 4 1
8 5 2
9 6 3
Levels:
1) just rotate matrix
2) matrix is 1D array (1 2 3 4 5 6 7 8 9)
3) input and output is the same memory block (the same array)
*/
#include <iostream>
#define N 3 // matrix size
// Matrix Generation for clear tests
void MatrixGenerate(int matr [], int size)
{
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run