Cody

Solution 1945441

Submitted on 22 Sep 2019 at 8:57 by Hoang Vu
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(6); y_correct = 111; assert(isequal(sum_of_sec_diag(x),y_correct))

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

2   Pass
x = magic(10); y_correct = 505; assert(isequal(sum_of_sec_diag(x),y_correct))

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

3   Pass
x = magic(11); y_correct = 671; assert(isequal(sum_of_sec_diag(x),y_correct))

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

4   Pass
x=[1 2 3; 4 4 6; 2 8 9]; y_correct = 9; assert(isequal(sum_of_sec_diag(x),y_correct))

z = 3 2 1 6 4 4 9 8 2

Suggested Problems

More from this Author1