Cody

# Problem 514. Spot the rectangle (Part 2)

Solution 3151826

Submitted on 10 Oct 2020 by A C
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 = [ 4 1 2 4 1 3 3 2 1 4 3 2 4 1 1 1 4 3 2 2 1 1 1 4 4 ]; tf = false; assert(isequal(has_rectangle(a),tf))

a = 0 1 0 0 1 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 TF = 0 a = 1×0 empty double row vector TF = 0 a = 1×0 empty double row vector TF = 0 a = 1×0 empty double row vector TF = 0

2   Pass
a = [ 1 4 3 1 3 1 4 1 1 3 4 1 1 1 2 3 ]; tf = true; assert(isequal(has_rectangle(a),tf))

a = 1 0 0 1 0 1 0 1 1 0 0 1 1 1 0 0 TF = 1 a = 1 0 1 0 1 1 1 0 1 1 1 0 d = 3 2 3

3   Pass
a = [ 1 2 4 2 2 3 1 4 1 4 2 3 4 3 2 2 2 2 4 3 1 3 1 1 2 ]; tf = false; assert(isequal(has_rectangle(a),tf))

a = 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 TF = 0 a = 0×1 empty double column vector TF = 0 a = 0×1 empty double column vector TF = 0 a = 0×1 empty double column vector TF = 0

4   Pass
a = ones(10); tf = true; assert(isequal(has_rectangle(a),tf))

a = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 TF = 1 a = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 d = 10 10 10 10 10 10 10 10 10 10

5   Pass
a = [ 2 3 1 3 2 4 1 1 2 1 4 3 1 2 1 3 4 2 4 2 4 2 4 1 1 2 4 3 1 1 3 1 2 4 3 3 4 3 1 1 1 1 3 1 3 4 2 1 3 1 3 1 2 1 3 1 1 1 1 2 1 3 3 4 ]; tf = true; assert(isequal(has_rectangle(a),tf))

a = 0 0 1 0 0 0 1 1 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 1 1 1 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 1 1 1 0 1 0 0 0 TF = 1 a = 0 0 1 0 0 0 1 1 0 1 0 0 1 0 1 0 1 0 0 0 1 1 0 1 0 0 0 0 0 0 1 1 1 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 1 1 1 0 1 0 0 0 d = 3 4 2 2 3 2 3 5

6   Pass
a = [ 2 1 4 2 3 2 4 1 4 1 2 2 1 4 4 2 3 3 1 2 4 4 3 1 3 3 2 4 1 4 4 4 3 2 3 4 ]; tf = false; assert(isequal(has_rectangle(a),tf))

a = 0 1 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 TF = 0 a = [] TF = 0 a = [] TF = 0 a = [] TF = 0

### Community Treasure Hunt

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

Start Hunting!