Cody

# Problem 502. Would Homer Like It?

Solution 3357113

Submitted on 24 Oct 2020 by Nikolaos Nikolaou
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 1 1; 1 0 1; 1 1 1; ]; tf = true; assert(isequal(has_doughnut(a),tf))

a = 2 4 2 4 8 4 2 4 2 idx = 3×0 empty double matrix arrfnd = 0 0 0 0 0 0 0 0 0 tf = logical 0 tf = logical 1

2   Pass
a = [ ... 1 0 0; 1 0 0; 1 1 0; ]; tf = false; assert(isequal(has_doughnut(a),tf))

a = 1 2 0 3 4 1 2 2 1 idx = 3×0 empty double matrix arrfnd = 0 0 0 0 0 0 0 0 0 tf = logical 0

3   Pass
a = [ ... 1 1 1 0; 1 0 1 0; 1 1 1 0; 0 0 0 0; ]; tf = true; assert(isequal(has_doughnut(a),tf))

a = 2 4 2 2 4 8 4 3 2 4 2 2 2 3 2 1 idx = 3×0 empty double matrix arrfnd = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 tf = logical 0 tf = logical 1

4   Pass
a = [ ... 0 0 0 0; 0 1 1 0; 0 1 1 0; 0 0 0 0; ]; tf = false assert(isequal(has_doughnut(a),tf))

tf = logical 0 a = 1 2 2 1 2 3 3 2 2 3 3 2 1 2 2 1 idx = 3×0 empty double matrix arrfnd = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 tf = logical 0

5   Pass
a = [ ... 0 1 0 1 0; 0 1 0 1 1; 0 1 0 0 1; 0 1 1 1 1; 0 0 0 0 0; ]; tf = false; assert(isequal(has_doughnut(a),tf))

a = 2 1 4 2 3 3 2 5 3 3 3 3 6 6 4 2 2 3 3 2 1 2 3 3 2 idx = 3×0 empty double matrix arrfnd = 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

6   Pass
a = [ ... 0 1 1 1 0; 0 1 0 1 1; 0 1 0 0 1; 0 1 1 1 1; 0 0 0 0 0; ]; tf = true; assert(isequal(has_doughnut(a),tf))

a = 2 2 4 3 3 3 3 6 4 3 3 3 6 6 4 2 2 3 3 2 1 2 3 3 2 idx = 12 13 18 arrfnd = 0 0 0 0 0 0 0 6 0 0 0 0 6 6 0 0 0 0 0 0 0 0 0 0 0 tf = logical 0 tf = logical 1

7   Pass
a = [ ... 0 1 0 1; 1 0 1 0; 0 1 0 1; ]; tf = false; assert(isequal(has_doughnut(a),tf))

a = 2 2 3 1 2 4 4 3 2 2 3 1 idx = 3×0 empty double matrix arrfnd = 0 0 0 0 0 0 0 0 0 0 0 0 tf = logical 0

### Community Treasure Hunt

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

Start Hunting!