Cody

# Problem 579. Spiral In

Solution 2122933

Submitted on 9 Feb 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
m = 3; n = 5; s_correct = [1 12 11 10 9; 2 13 14 15 8; 3 4 5 6 7]; assert(isequal(spiralIn(m,n),s_correct))

m = 11 n = 10 q = 1 38 37 36 35 34 33 32 31 30 2 39 68 67 66 65 64 63 62 29 3 40 69 90 89 88 87 86 61 28 4 41 70 91 104 103 102 85 60 27 5 42 71 92 105 110 101 84 59 26 6 43 72 93 106 109 100 83 58 25 7 44 73 94 107 108 99 82 57 24 8 45 74 95 96 97 98 81 56 23 9 46 75 76 77 78 79 80 55 22 10 47 48 49 50 51 52 53 54 21 11 12 13 14 15 16 17 18 19 20

Assertion failed.

2   Fail
m = 5; n = 3; s_correct = [1 12 11; 2 13 10; 3 14 9; 4 15 8; 5 6 7]; assert(isequal(spiralIn(m,n),s_correct))

m = 11 n = 10 q = 1 38 37 36 35 34 33 32 31 30 2 39 68 67 66 65 64 63 62 29 3 40 69 90 89 88 87 86 61 28 4 41 70 91 104 103 102 85 60 27 5 42 71 92 105 110 101 84 59 26 6 43 72 93 106 109 100 83 58 25 7 44 73 94 107 108 99 82 57 24 8 45 74 95 96 97 98 81 56 23 9 46 75 76 77 78 79 80 55 22 10 47 48 49 50 51 52 53 54 21 11 12 13 14 15 16 17 18 19 20

Assertion failed.

3   Fail
m = 1; n = 1; s_correct = 1; assert(isequal(spiralIn(m,n),s_correct))

m = 11 n = 10 q = 1 38 37 36 35 34 33 32 31 30 2 39 68 67 66 65 64 63 62 29 3 40 69 90 89 88 87 86 61 28 4 41 70 91 104 103 102 85 60 27 5 42 71 92 105 110 101 84 59 26 6 43 72 93 106 109 100 83 58 25 7 44 73 94 107 108 99 82 57 24 8 45 74 95 96 97 98 81 56 23 9 46 75 76 77 78 79 80 55 22 10 47 48 49 50 51 52 53 54 21 11 12 13 14 15 16 17 18 19 20

Assertion failed.

4   Fail
m = 5; n = 0; s_correct = zeros(5,0); assert(isequal(spiralIn(m,n),s_correct))

m = 11 n = 10 q = 1 38 37 36 35 34 33 32 31 30 2 39 68 67 66 65 64 63 62 29 3 40 69 90 89 88 87 86 61 28 4 41 70 91 104 103 102 85 60 27 5 42 71 92 105 110 101 84 59 26 6 43 72 93 106 109 100 83 58 25 7 44 73 94 107 108 99 82 57 24 8 45 74 95 96 97 98 81 56 23 9 46 75 76 77 78 79 80 55 22 10 47 48 49 50 51 52 53 54 21 11 12 13 14 15 16 17 18 19 20

Assertion failed.

5   Fail
m = 2; n = 2; s_correct = [1 4; 2 3]; assert(isequal(spiralIn(m,n),s_correct))

m = 11 n = 10 q = 1 38 37 36 35 34 33 32 31 30 2 39 68 67 66 65 64 63 62 29 3 40 69 90 89 88 87 86 61 28 4 41 70 91 104 103 102 85 60 27 5 42 71 92 105 110 101 84 59 26 6 43 72 93 106 109 100 83 58 25 7 44 73 94 107 108 99 82 57 24 8 45 74 95 96 97 98 81 56 23 9 46 75 76 77 78 79 80 55 22 10 47 48 49 50 51 52 53 54 21 11 12 13 14 15 16 17 18 19 20

Assertion failed.

### Community Treasure Hunt

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

Start Hunting!