Cody

# Problem 67. Find common elements in matrix rows

Solution 1879647

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   Pass
x = [1e100; 1e100]; y_correct = [1e100]; assert(isequal(common_by_row(x),y_correct))

y = 1.0000e+100

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

y = 1 2

Assertion failed.

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

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

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

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

Assertion failed.

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

y = 0 1 4 y = 0 1 3 y = 0 1 2 y = 0 1 y = 0 1 y = 0 1 y = 0 1 2 y = 0 1 3 y = 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 = -2 1 y = 3 NaN

Assertion failed.