Cody

# Problem 45453. Spiral Out - 02

Solution 3682088

Submitted on 16 Nov 2020
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
p= 1:27; y= [21 22 23 24 25 26 20 7 8 9 10 27 19 6 1 2 11 0 18 5 4 3 12 0 17 16 15 14 13 0 0 0 0 0 0 0]; assert(isequal(spi_out_3(p),y))

m = 21 22 23 24 25 26 20 7 8 9 10 27 19 6 1 2 11 28 18 5 4 3 12 29 17 16 15 14 13 30 36 35 34 33 32 31

Output argument "y" (and maybe others) not assigned during call to "spi_out_3". Error in Test1 (line 8) assert(isequal(spi_out_3(p),y))

2   Fail
p= 49:-1:1; y= [7 6 5 4 3 2 1 8 29 28 27 26 25 24 9 30 43 42 41 40 23 10 31 44 49 48 39 22 11 32 45 46 47 38 21 12 33 34 35 36 37 20 13 14 15 16 17 18 19]; assert(isequal(spi_out_3(p),y))

m = 43 44 45 46 47 48 49 42 21 22 23 24 25 26 41 20 7 8 9 10 27 40 19 6 1 2 11 28 39 18 5 4 3 12 29 38 17 16 15 14 13 30 37 36 35 34 33 32 31

Output argument "y" (and maybe others) not assigned during call to "spi_out_3". Error in Test2 (line 9) assert(isequal(spi_out_3(p),y))

3   Fail
p=[4074 4529 635 4567 3162 488 1393 2735 4788 4825 789 4853 4786 2427 4002 710 2109 4579 3962 4798 3279 179 4246 4670 3394 3789 3716 1962 3278 856 3531 160 1385 231 486 4118 3475 1586 4752 173 2194 1908 3828 3976 935 2449 2228 3232 3547 3774 1381 3399 3276 814 595 2492 4799 1702 2927 1120 3757 1276 2530 3496 4455 4797 2737 694 747 1288 4204 1272 4072 1218 4647 1750 983 1256 3081 2367 1759 4155 2927 2749 4586 1430 3787 3769 1903 2840 380 270 2654 3896 4671 650 2845 2347 60 1686 811 3972 1557 2643 829 3010 1315 3271 3447 3741 2253 420 1145 4567 762 4130 2692 4981 391 2214 534 4810 24 3875 4087 4344 423 1999 1300 4001 2158 4554 910 1320 728 681 4347 2899 2750 725 4266 3111 1755 2567 2010 380 1200 617 920 1200 2087 249 4514 4724 2455 2447 1689 4501 1847 557 3902 1949 1209 2020 483 660 4711 4781 2877 299 1174 1766 4106 78 216 845 3246 3659 3239 2255 2736 1482 3724 945 3434 918 1843 3129 3902 406 4647 3879 2434 2180 2234 1532 2543 2554 4089 3975]; y= [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1689 4501 1847 557 3902 1949 1209 2020 483 660 4711 4781 2877 299 0 2447 2253 420 1145 4567 762 4130 2692 4981 391 2214 534 4810 1174 0 2455 3741 4072 1218 4647 1750 983 1256 3081 2367 1759 4155 24 1766 0 4724 3447 1272 3828 3976 935 2449 2228 3232 3547 3774 2927 3875 4106 0 4514 3271 4204 1908 3279 179 4246 4670 3394 3789 1381 2749 4087 78 0 249 1315 1288 2194 4798 1393 2735 4788 4825 3716 3399 4586 4344 216 0 2087 3010 747 173 3962 488 4074 4529 789 1962 3276 1430 423 845 0 1200 829 694 4752 4579 3162 4567 635 4853 3278 814 3787 1999 3246 0 920 2643 2737 1586 2109 710 4002 2427 4786 856 595 3769 1300 3659 0 617 1557 4797 3475 4118 486 231 1385 160 3531 2492 1903 4001 3239 3975 1200 3972 4455 3496 2530 1276 3757 1120 2927 1702 4799 2840 2158 2255 4089 380 811 1686 60 2347 2845 650 4671 3896 2654 270 380 4554 2736 2554 2010 2567 1755 3111 4266 725 2750 2899 4347 681 728 1320 910 1482 2543 1532 2234 2180 2434 3879 4647 406 3902 3129 1843 918 3434 945 3724]; assert(isequal(spi_out_3(p),y))

m = 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 210 157 158 159 160 161 162 163 164 165 166 167 168 169 170 209 156 111 112 113 114 115 116 117 118 119 120 121 122 171 208 155 110 73 74 75 76 77 78 79 80 81 82 123 172 207 154 109 72 43 44 45 46 47 48 49 50 83 124 173 206 153 108 71 42 21 22 23 24 25 26 51 84 125 174 205 152 107 70 41 20 7 8 9 10 27 52 85 126 175 204 151 106 69 40 19 6 1 2 11 28 53 86 127 176 203 150 105 68 39 18 5 4 3 12 29 54 87 128 177 202 149 104 67 38 17 16 15 14 13 30 55 88 129 178 201 148 103 66 37 36 35 34 33 32 31 56 89 130 179 200 147 102 65 64 63 62 61 60 59 58 57 90 131 180 199 146 101 100 99 98 97 96 95 94 93 92 91 132 181 198 145 144 143 142 141 140 139 138 137 136 135 134 133 182 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183

Output argument "y" (and maybe others) not assigned during call to "spi_out_3". Error in Test3 (line 17) assert(isequal(spi_out_3(p),y))

4   Fail
p= pascal(6); p=p(:)'; y= [10 20 35 56 1 5 4 1 2 3 4 15 1 1 1 1 5 35 21 1 1 1 6 70 15 10 6 3 1 126 252 126 56 21 6 1]; assert(isequal(spi_out_3(p),y))

m = 21 22 23 24 25 26 20 7 8 9 10 27 19 6 1 2 11 28 18 5 4 3 12 29 17 16 15 14 13 30 36 35 34 33 32 31

Output argument "y" (and maybe others) not assigned during call to "spi_out_3". Error in Test4 (line 9) assert(isequal(spi_out_3(p),y))

5   Fail
p= eye(6); p=p(:)' y= [0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0]; assert(isequal(spi_out_3(p),y))

p = Columns 1 through 29 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 Columns 30 through 36 0 0 0 0 0 0 1 m = 21 22 23 24 25 26 20 7 8 9 10 27 19 6 1 2 11 28 18 5 4 3 12 29 17 16 15 14 13 30 36 35 34 33 32 31

Output argument "y" (and maybe others) not assigned during call to "spi_out_3". Error in Test5 (line 9) assert(isequal(spi_out_3(p),y))

6   Fail
p= [-84 -132 -54 -104 -137 -31 -42 -101 -88 -94 -163 -146 -115,-159 -48]; y= [-42 -101 -88 -94 -31 -84 -132 -163 -137 -104 -54 -146 0 -48 -159 -115]; assert(isequal(spi_out_3(p),y))

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

Output argument "y" (and maybe others) not assigned during call to "spi_out_3". Error in Test6 (line 6) assert(isequal(spi_out_3(p),y))

7   Fail
filetext = fileread('spi_out_3.m'); assert(isempty(strfind(filetext, 'spiral')),'spiral() forbidden')

spiral() forbidden

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!