Cody

# Problem 67. Find common elements in matrix rows

Solution 201851

Submitted on 7 Feb 2013 by Jeremy
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 = []; y_correct = []; assert(isequal(common_by_row(x),y_correct))

y = [] y = []

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

y = [] e = 1.0000e+100 r = 1.0000e+100 f = 1 r = 1.0000e+100 f = 1 y = 1.0000e+100 e = 1.0000e+100 r = 1.0000e+100 f = 1 r = 1.0000e+100 f = 1 y = 1.0000e+100

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

y = [] e = 1 r = 1 f = 1 r = 2 f = 0 e = 2 r = 1 f = 0 y = []

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

y = [] e = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 y = 1 e = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1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1 1 1 1 1 f = 1 r = 1 1 1 1 1 1 1 1 1 1 f = 1 r = 1 1 1 1 ...

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

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

6   Fail