Cody

Solution 2186506

Submitted on 1 Apr 2020 by Binbin Qi
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
x = magic(4); y=[16 2 3 13 8 12 1 15 14 4 9 5 11 10 6 7] assert(isequal(spiral_pattern(x),y))

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

2   Pass
x=reshape([89:124],3,[]); y=[89 92 95 98 101 104 107 110 113 116 119 122 123 124 121 118 115 112 109 106 103 100 97 94 91 90 93 96 99 102 105 108 111 114 117 120] assert(isequal(spiral_pattern(x),y))

y = Columns 1 through 29 89 92 95 98 101 104 107 110 113 116 119 122 123 124 121 118 115 112 109 106 103 100 97 94 91 90 93 96 99 Columns 30 through 36 102 105 108 111 114 117 120

3   Pass
x = ones(8,2); y=ones(1,16); assert(isequal(spiral_pattern(x),y))

4   Pass
x = [17 24 1 23 5 1 4 6 1 10 12 1 11 18 1] y=[17 24 1 1 1 1 1 18 11 10 4 23 5 6 12] assert(isequal(spiral_pattern(x),y))

x = 17 24 1 23 5 1 4 6 1 10 12 1 11 18 1 y = 17 24 1 1 1 1 1 18 11 10 4 23 5 6 12

5   Pass
x = magic(9); y=[47 58 69 80 1 12 23 34 45 46 56 66 76 5 15 25 35 24 13 2 81 70 59 48 37 36 26 16 6 77 67 57 68 79 9 11 22 33 44 54 55 65 75 4 14 3 73 71 60 49 38 28 27 17 7 78 8 10 21 32 43 53 63 64 74 72 61 50 39 29 19 18 20 31 42 52 62 51 40 30 41] assert(isequal(spiral_pattern(x),y))

y = Columns 1 through 29 47 58 69 80 1 12 23 34 45 46 56 66 76 5 15 25 35 24 13 2 81 70 59 48 37 36 26 16 6 Columns 30 through 58 77 67 57 68 79 9 11 22 33 44 54 55 65 75 4 14 3 73 71 60 49 38 28 27 17 7 78 8 10 Columns 59 through 81 21 32 43 53 63 64 74 72 61 50 39 29 19 18 20 31 42 52 62 51 40 30 41

Suggested Problems

More from this Author145