Cody

# Problem 67. Find common elements in matrix rows

Solution 1879653

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))

t = 0×1 empty double column vector

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))

t = 1.0000e+100 I = 1 2 J = 1 1

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

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

t = 1 2 I = 1 J = 1 I = 2 J = 1

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

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

t = 1 I = 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 J = 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10

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

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

t = 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 100 I = 1 J = 3 I = 5 J = 4 I = 4 J = 5 I = 3 J = 1 I = 7 J = 2 I = 8 J = 2 I = 2 J = 3 I = 1 J = 4 I = 5 J = 5 I = 9 J = 1 I = 10 J = 1 I = 9 J = 2 I = 8 J = 3 I = 2 J = 4 I = 1 J = 5 I = 2 J = 5 I = 6 J = 1 I = 10 J = 2 I = 4 J = 3 I = 3 J = 4 I = 4 J = 4 I = 3 J = 5 I = 7 J = 1 I = 6 J = 2 I = 5 J = 3 I = 6 J = 8 I = 10 J = 9 I = 4 J = 10 I = 8 J = 6 I = 7 J = 7 I = 8 J = 7 I = 7 J = 8 I = 6 J = 9 I = 5 J = 10 I = 9 J = 6 I = 10 J = 6 I = 9 J = 7 I = 8 J = 8 I = 7 J = 9 I = 1 J = 10 I = 2 J = 10 I = 6 J = 6 I = 10 J = 7 I = 9 J = 8 I = 8 J = 9 I = 9 J = 9 I = 3 J = 10 I = 7 J = 6 I = 6 J = 7 I = 10 J = 8 I = 1 J = 8 I = 5 J = 9 I = 9 J = 10 I = 3 J = 6 I = 2 J = 7 I = 3 J = 7 I = 2 J = 8 I = 1 J = 9 I = 10 J = 10 I = 4 J = 6 I = 5 J = 6 I = 4 J = 7 I = 3 J = 8 I = 2 J = 9 I = 6 J = 10 I = 7 J = 10 I = 1 J = 6 I = 5 J = 7 I = 4 J = 8 I = 3 J = 9 I = 4 J = 9 I = 8 J = 10 I = 2 J = 6 I = 1 J = 7 I = 5 J = 8 I = 6 J = 3 I = 10 J = 4 I = 9 J = 5 I = 8 J = 1 I = 2 J = 2 I = 3 J = 2 I = 7 J = 3 I = 6 J = 4 I = 10 J = 5 I = 4 J = 1 I = 5 J = 1 I = 4 J = 2 I = 3 J = 3 I = 7 J = 4 I = 6 J = 5 I = 7 J = 5 I = 1 J = 1 I = 5 J = 2 I = 9 J = 3 I = 8 J = 4 I = 9 J = 4 I = 8 J = 5 I = 2 J = 1 I = 1 J = 2 I = 10 J = 3

Output argument "y" (and maybe others) not assigned during call to "common_by_row". 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))

t = 0 1 2 3 4 I = 3 4 5 6 7 8 9 4 5 6 7 8 9 1 5 6 7 8 9 1 2 6 7 8 9 1 2 3 5 7 8 9 1 2 3 4 8 9 1 2 3 4 5 9 1 2 3 4 5 6 1 2 3 4 5 6 7 J = 1 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 4 4 4 4 4 4 5 5 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 8 8 8 8 8 8 9 9 9 9 9 9 9 I = 2 1 3 2 4 3 4 5 4 6 5 6 7 6 8 7 9 8 J = 1 2 2 3 3 4 4 4 5 5 6 6 6 7 7 8 8 9 I = 3 7 J = 3 7 I = 2 8 J = 2 8 I = 1 9 J = 1 9

Output argument "y" (and maybe others) not assigned during call to "common_by_row". 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))

t = -2 0 1 3 NaN NaN I = 1 2 J = 2 3 I = 2 J = 2 I = 1 J = 3 I = 1 2 J = 1 4 I = 0×1 empty double column vector J = 0×1 empty double column vector I = 0×1 empty double column vector J = 0×1 empty double column vector

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