Cody

# Problem 45216. Rotate a matrix without using rot90

Solution 2075480

Submitted on 31 Dec 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
x = magic(3); degrees=180; y_correct = rot90(x,2); assert(isequal( rot(x,degrees),y_correct))

y = [] y = 4 3 8 9 5 1 2 7 6

Assertion failed.

2   Pass
x = magic(4); degrees=270; y_correct = rot90(x,3); assert(isequal( rot(x,degrees),y_correct))

y = [] y = 4 9 5 16 14 7 11 2 15 6 10 3 1 12 8 13

3   Fail
x = magic(5); degrees=360; y_correct = x; assert(isequal( rot(x,degrees),y_correct))

y = [] y = 11 10 4 23 17 18 12 6 5 24 25 19 13 7 1 2 21 20 14 8 9 3 22 16 15

Assertion failed.

4   Pass
x=[1,4,2,6;3,4,5,6;1,1,1,1;2,2,2,2]; degrees=630; y_correct = rot90(x,7); assert(isequal( rot(x,degrees),y_correct))

y = [] y = 2 1 3 1 2 1 4 4 2 1 5 2 2 1 6 6

5   Fail
x=[1,4,2,6;3,4,5,6;1,1,1,1;2,2,2,2]; degrees=1170; y_correct = rot90(x,13); assert(isequal( rot(x,degrees),y_correct))

y = [] y = 2 1 3 1 2 1 4 4 2 1 5 2 2 1 6 6

Assertion failed.

6   Pass
assert(isempty(regexp(evalc('type rot'),'(eval|flip|transpose|fliplr|flipud|flipdim|rot90|)')))