Cody

# Problem 924. intersection of matrices

Solution 1946795

Submitted on 23 Sep 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
A = [1 0 0 0 0;... 0 1 0 0 0;... 0 0 1 0 0;... 0 0 0 1 0;... 0 0 0 0 1]; B = [0 1 0 0 0;... 0 0 1 0 0;... 0 0 0 1 0;... 0 0 0 0 1;... 1 0 0 0 0]; tf_correct = 0; assert(isequal(intersection_of_matrices(A,B),tf_correct))

Index exceeds the number of array elements (5). Error in intersection_of_matrices (line 5) tf(n)=length(find(A==B(B))) Error in Test1 (line 12) assert(isequal(intersection_of_matrices(A,B),tf_correct))

2   Fail
A = [1 1 0 0 0;... 0 1 1 0 0;... 0 0 1 1 0;... 0 0 0 1 1;... 1 0 0 0 1]; B = [0 0 0 0 1;... 1 0 0 0 0;... 0 1 0 0 0;... 0 0 1 0 0;... 0 0 0 1 0]; tf_correct = 0; assert(isequal(intersection_of_matrices(A,B),tf_correct))

Index exceeds the number of array elements (5). Error in intersection_of_matrices (line 5) tf(n)=length(find(A==B(B))) Error in Test2 (line 14) assert(isequal(intersection_of_matrices(A,B),tf_correct))

3   Fail
A = [1 1 0 0 1;... 1 1 1 0 0;... 0 1 1 1 0;... 0 0 1 1 1;... 1 0 0 1 1]; B = [0 0 1 0 0;... 0 0 0 1 0;... 0 0 0 0 1;... 1 0 0 0 0;... 0 1 0 0 0]; tf_correct = 0; assert(isequal(intersection_of_matrices(A,B),tf_correct))

Index exceeds the number of array elements (5). Error in intersection_of_matrices (line 5) tf(n)=length(find(A==B(B))) Error in Test3 (line 13) assert(isequal(intersection_of_matrices(A,B),tf_correct))

4   Fail
A = [1 1 1 0 1;... 1 1 1 1 0;... 0 1 1 1 1;... 1 0 1 1 1;... 1 1 0 1 1]; B = [0 1 0 0 0;... 1 0 0 0 0;... 0 0 0 0 1;... 0 0 0 1 0;... 0 0 1 0 0]; tf_correct = 1; assert(isequal(intersection_of_matrices(A,B),tf_correct))

Index exceeds the number of array elements (5). Error in intersection_of_matrices (line 5) tf(n)=length(find(A==B(B))) Error in Test4 (line 12) assert(isequal(intersection_of_matrices(A,B),tf_correct))

5   Fail
A = [1 1 0 0 1;... 1 1 1 0 0;... 0 1 1 1 0;... 0 0 1 1 1;... 1 1 0 1 1]; B = [0 0 1 0 0;... 0 0 0 1 0;... 0 0 0 0 1;... 1 0 0 0 0;... 0 1 0 0 0]; tf_correct = 1; assert(isequal(intersection_of_matrices(A,B),tf_correct))

Index exceeds the number of array elements (5). Error in intersection_of_matrices (line 5) tf(n)=length(find(A==B(B))) Error in Test5 (line 13) assert(isequal(intersection_of_matrices(A,B),tf_correct))