Cody

Solution 312842

Submitted on 30 Aug 2013 by J-G van der Toorn
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   Pass
1
ans = 1
2   Pass
%% x=[1 3;2 4]; y_correct=[0 3 0;1 0 4;0 2 0]; assert(isequal(rot45(x),y_correct)); 2
ans = 2
3   Pass
%% 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
ans = 3
4   Pass
%% 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
ans = 4
5   Pass
%% 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));