Cody

Solution 2104021

Submitted on 23 Jan 2020 at 22:29
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
x = []; y_correct = []; assert(isequal(common_by_row(x),y_correct))

x = [] Aa = []

Index in position 1 exceeds array bounds. Error in common_by_row (line 4) Ab=x(1,:) Error in Test1 (line 3) assert(isequal(common_by_row(x),y_correct))

2   Pass
x = [1e100; 1e100]; y_correct = [1e100]; assert(isequal(common_by_row(x),y_correct))

x = 1.0e+100 * 1.0000 1.0000 Aa = 1.0000e+100 Ab = 1.0000e+100 xx = 0 ddd = 1 1 size_of_rows_colmns = 2 1 i = 1 b = 1 c = 1 b = 1 cc = 1 xx = 1 y = 1.0000e+100 y = 1.0000e+100

3   Fail
x = [1; 2]; y_correct = []; assert(isequal(common_by_row(x),y_correct))

x = 1 2 Aa = 2 Ab = 1 xx = 0 ddd = 1 1 size_of_rows_colmns = 2 1 i = 1 b = [] c = [] b = 0×1 empty double column vector cc = 1×0 empty double row vector

Unrecognized function or variable 'y'. Error in common_by_row (line 19) y=unique(y) Error in Test3 (line 3) assert(isequal(common_by_row(x),y_correct))

4   Pass
x = ones(10); y_correct = [1]; assert(isequal(common_by_row(x),y_correct))

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

5   Fail
x = magic(10); y_correct = []; assert(isequal(common_by_row(x),y_correct))

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

Unrecognized function or variable 'y'. Error in common_by_row (line 19) y=unique(y) Error in Test5 (line 3) assert(isequal(common_by_row(x),y_correct))

6   Fail
x = wilkinson(9); y_correct = [0 1]; assert(isequal(common_by_row(x),y_correct))

x = 4 1 0 0 0 0 0 0 0 1 3 1 0 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 0 1 3 1 0 0 0 0 0 0 0 1 4 Aa = 1 0 0 0 0 0 0 0 1 3 1 0 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 0 1 3 1 0 0 0 0 0 0 0 1 4 Ab = 4 xx = 0 ddd = 80 1 size_of_rows_colmns = 81 1 i = 1 b = 80 c = 1 b = 80 cc = 80

Unrecognized function or variable 'y'. Error in common_by_row (line 19) y=unique(y) Error in Test6 (line 3) assert(isequal(common_by_row(x),y_correct))

7   Fail
x = [3 -2 1 NaN; NaN 0 -2 3]; y_correct = [-2 3]; assert(isequal(common_by_row(x),y_correct))

x = 3 -2 0 1 -2 3 Aa = -2 0 1 -2 3 Ab = 3 xx = 0 ddd = 5 1 size_of_rows_colmns = 6 1 i = 1 b = 5 c = 1 b = 5 cc = 5

Unrecognized function or variable 'y'. Error in common_by_row (line 19) y=unique(y) Error in Test7 (line 3) assert(isequal(common_by_row(x),y_correct))