Cody

Solution 1699662

Submitted on 26 Dec 2018
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=[1 3;2 4]; y_correct=[0 3 0;1 0 4;0 2 0]; assert(isequal(rot45(x),y_correct)); 2

Error using rot90 (line 38) k must be an integer. Error in rot45 (line 2) y = rot90(x,1/2); Error in Test1 (line 3) assert(isequal(rot45(x),y_correct));

2   Fail
for n=1:10 x=rand(n); y=rot45(rot45(x)); assert(isequal(x,rot90(y(n:2:end-n+1,n:2:end-n+1),-1))); end 3

Error using rot90 (line 38) k must be an integer. Error in rot45 (line 2) y = rot90(x,1/2); Error in Test2 (line 3) y=rot45(rot45(x));

3   Fail
x=rand(5); i=[5 13 15 21 23 25 29 31 33 35 37 39 41 43 45 47 49 51 53 57 59 61 67 69 77]; j=[1 6 2 11 7 3 16 12 8 4 21 17 13 9 5 22 18 14 10 23 19 15 24 20 25]; y_correct=zeros(9); y_correct(i)=x(j); assert(isequal(rot45(x),y_correct)); 4

Error using rot90 (line 38) k must be an integer. Error in rot45 (line 2) y = rot90(x,1/2); Error in Test3 (line 6) assert(isequal(rot45(x),y_correct));

4   Fail
x=rand(8); i=[8 22 24 36 38 40 50 52 54 56 64 66 68 70 72 78 80 82 84 86 88 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 138 140 142 144 146 148 154 156 158 160 162 170 172 174 176 186 188 190 202 204 218 ]; j=[1 9 2 17 10 3 25 18 11 4 33 26 19 12 5 41 34 27 20 13 6 49 42 35 28 21 14 7 57 50 43 36 29 22 15 8 58 51 44 37 30 23 16 59 52 45 38 31 24 60 53 46 39 32 61 54 47 40 62 55 48 63 56 64 ]; y_correct=zeros(15); y_correct(i)=x(j); assert(isequal(rot45(x),y_correct));

Error using rot90 (line 38) k must be an integer. Error in rot45 (line 2) y = rot90(x,1/2); Error in Test4 (line 6) assert(isequal(rot45(x),y_correct));