Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 191509

Submitted on 16 Jan 2013 by Alfonso Nieto-Castanon

Correct

41Size
This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
a = [ ...
 1 1 1;
 1 0 1;
 1 1 1;
];
tf = true;
assert(isequal(has_doughnut(a),tf))

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

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

                    
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 =
     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))

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

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