Cody

# Problem 512. Spot the rectangle

Solution 2227288

Submitted on 21 Apr 2020
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 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 ]; tf = false; assert(isequal(has_rectangle(a),tf))

R = 5 C = 5

Unrecognized function or variable 'r2'. Error in has_rectangle (line 5) E = A(r2,:); Error in Test1 (line 7) assert(isequal(has_rectangle(a),tf))

2   Fail
a = [ 1 0 1 0 0 0 1 0 1 0 1 0 0 0 1 1 ]; tf = true; assert(isequal(has_rectangle(a),tf))

R = 4 C = 4

Unrecognized function or variable 'r2'. Error in has_rectangle (line 5) E = A(r2,:); Error in Test2 (line 6) assert(isequal(has_rectangle(a),tf))

3   Fail
a = [ 1 0 1 0 0 0 1 1 0 0 1 1 ]; tf = true; assert(isequal(has_rectangle(a),tf))

R = 3 C = 4

Unrecognized function or variable 'r2'. Error in has_rectangle (line 5) E = A(r2,:); Error in Test3 (line 5) assert(isequal(has_rectangle(a),tf))

4   Fail
a = [ 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 ]; tf = true; assert(isequal(has_rectangle(a),tf))

R = 3 C = 9

Unrecognized function or variable 'r2'. Error in has_rectangle (line 5) E = A(r2,:); Error in Test4 (line 5) assert(isequal(has_rectangle(a),tf))

5   Fail
a = zeros(20); tf = false; assert(isequal(has_rectangle(a),tf))

R = 20 C = 20

Unrecognized function or variable 'r2'. Error in has_rectangle (line 5) E = A(r2,:); Error in Test5 (line 3) assert(isequal(has_rectangle(a),tf))

6   Fail
a = ones(9); tf = true; assert(isequal(has_rectangle(a),tf))

R = 9 C = 9

Unrecognized function or variable 'r2'. Error in has_rectangle (line 5) E = A(r2,:); Error in Test6 (line 3) assert(isequal(has_rectangle(a),tf))

7   Fail
a = double(magic(6)<9); tf = false; assert(isequal(has_rectangle(a),tf))

R = 6 C = 6

Unrecognized function or variable 'r2'. Error in has_rectangle (line 5) E = A(r2,:); Error in Test7 (line 3) assert(isequal(has_rectangle(a),tf))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!