Cody

Solution 1656179

Submitted on 22 Oct 2018 by Bob Tivnan
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 = [] m = 0 n = 0 u = 1×0 empty double row vector

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

y = [] m = 2 n = 1 u = 1.0000e+100 1 1.0000e+100 1 1.0000e+100 y = 1.0000e+100

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

y = [] m = 2 n = 1 u = 1 2 1 1 1 2 2 1 2 2

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

y = [] m = 10 n = 10 u = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 y = 1

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

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

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

y = [] m = 9 n = 9 u = 0 1 2 3 4 1 0 1 4 1 0 1 3 1 0 1 2 1 0 1 1 0 1 1 0 1 1 0 1 2 1 0 1 3 1 0 1 4 y = 0 2 0 1 4 2 0 1 3 2 0 1 2 2 0 1 2 0 1 2 0 1 2 0 1 2 2 0 1 3 2 0 1 4 y = 0 1 3 0 1 4 3 0 1 3 3 0 1 2 3 0 1 3 0 1 3 0 1 3 0 1 2 3 0 1 3 3 0 1 4 4 0 1 4 4 0 1 3 4 0 1 2 4 0 1 4 0 1 4 0 1 4 0 1 2 4 0 1 3 4 0 1 4 5 0 1 4 5 0 1 3 5 0 1 2 5 0 1 5 0 1 5 0 1 5 0 1 2 5 0 1 3 5 0 1 4

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

y = [] m = 2 n = 4 u = -2 0 1 3 NaN NaN 1 -2 1 3 NaN 1 -2 0 3 NaN y = -2 2 -2 1 3 NaN 2 -2 0 3 NaN 3 -2 1 3 NaN 3 -2 0 3 NaN 4 -2 1 3 NaN 4 -2 0 3 NaN y = -2 3 5 -2 1 3 NaN 5 -2 0 3 NaN 6 -2 1 3 NaN 6 -2 0 3 NaN

More from this Author95