Cody

Solution 1929609

Submitted on 10 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   Pass
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))

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

tf = 1 tf = 1

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

Index in position 1 exceeds array bounds (must not exceed 3). Error in has_rectangle (line 5) if (k~=h) & (a([k h],[k h]) == ones(2)) 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))

Index in position 1 exceeds array bounds (must not exceed 3). Error in has_rectangle (line 5) if (k~=h) & (a([k h],[k h]) == ones(2)) Error in Test4 (line 5) assert(isequal(has_rectangle(a),tf))

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

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

tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1 tf = 1

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

Suggested Problems

More from this Author49