Cody

# Problem 924. intersection of matrices

Solution 2054503

Submitted on 11 Dec 2019 by jack walker
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
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))

ans = 5×5 logical array 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 1 1 1 0 ans = 5×5 logical array 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 ans = 5×5 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 tf = logical 0

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

ans = 5×5 logical array 0 0 1 1 0 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 0 1 1 0 0 ans = 5×5 logical array 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 ans = 5×5 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 tf = logical 0

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

ans = 5×5 logical array 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 ans = 5×5 logical array 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 ans = 5×5 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 tf = logical 0

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

ans = 5×5 logical array 0 1 0 1 0 1 0 0 0 1 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 ans = 5×5 logical array 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 ans = 5×5 logical array 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 tf = logical 1

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

ans = 5×5 logical array 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 1 1 0 0 ans = 5×5 logical array 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 ans = 5×5 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 tf = logical 1