Cody

Problem 514. Spot the rectangle (Part 2)

Solution 3219838

Submitted on 15 Oct 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 = [ 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))

Unrecognized function or variable 'oneind'. Error in has_rectangle (line 5) for index = 1:length(oneind) Error in Test1 (line 7) assert(isequal(has_rectangle(a),tf))

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

Unrecognized function or variable 'oneind'. Error in has_rectangle (line 5) for index = 1:length(oneind) Error in Test2 (line 6) assert(isequal(has_rectangle(a),tf))

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

Unrecognized function or variable 'oneind'. Error in has_rectangle (line 5) for index = 1:length(oneind) Error in Test3 (line 7) assert(isequal(has_rectangle(a),tf))

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

Unrecognized function or variable 'oneind'. Error in has_rectangle (line 5) for index = 1:length(oneind) Error in Test4 (line 3) assert(isequal(has_rectangle(a),tf))

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

Unrecognized function or variable 'oneind'. Error in has_rectangle (line 5) for index = 1:length(oneind) Error in Test5 (line 10) assert(isequal(has_rectangle(a),tf))

6   Fail
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))

Unrecognized function or variable 'oneind'. Error in has_rectangle (line 5) for index = 1:length(oneind) Error in Test6 (line 8) assert(isequal(has_rectangle(a),tf))

Suggested Problems

More from this Author50

Community Treasure Hunt

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

Start Hunting!