Cody

# Problem 45216. Rotate a matrix without using rot90

Solution 2075485

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 = [] ans = 2

Assertion failed.

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

y = [] ans = 3

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

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

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 = [] ans = 3

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 = [] ans = 1 x = 2 1 3 1 2 1 4 4 2 1 5 2 2 1 6 6 y = []

Assertion failed.

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