Cody

# Problem 67. Find common elements in matrix rows

Solution 1879644

Submitted on 20 Jul 2019
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))

Output argument "y" (and maybe others) not assigned during call to "common_by_row". Error in Test1 (line 3) assert(isequal(common_by_row(x),y_correct))

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

y = 1.0e+100 * 1.0000 1.0000

Assertion failed.

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

y = 1 2

Assertion failed.

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

y = 1 1 1 1 1 1 1 1 1 1 y = 1 1 1 1 1 1 1 1 1 1 y = 1 1 1 1 1 1 1 1 1 1 y = 1 1 1 1 1 1 1 1 1 1 y = 1 1 1 1 1 1 1 1 1 1 y = 1 1 1 1 1 1 1 1 1 1 y = 1 1 1 1 1 1 1 1 1 1 y = 1 1 1 1 1 1 1 1 1 1 y = 1 1 1 1 1 1 1 1 1 1 y = 1 1 1 1 1 1 1 1 1 1

Assertion failed.

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

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

Assertion failed.

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

y = 4 1 0 0 0 0 0 0 0 y = 1 3 1 0 0 0 0 0 0 y = 0 1 2 1 0 0 0 0 0 y = 0 0 1 1 1 0 0 0 0 y = 0 0 0 1 0 1 0 0 0 y = 0 0 0 0 1 1 1 0 0 y = 0 0 0 0 0 1 2 1 0 y = 0 0 0 0 0 0 1 3 1 y = 0 0 0 0 0 0 0 1 4

Assertion failed.

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

y = 3 NaN y = -2 0 y = 1 -2 y = NaN 3

Assertion failed.