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 416787

Submitted on 12 Mar 2014 by Paul Berglund

Correct

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

This solution is outdated. To rescore this solution, log in.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
x=[  1     2     7     6     7     2     7     7 ;
     7     7     5     3     5     3     2     5 ;
     1     6     5     4     3     5     7     5 ;
     6     6     7     4     6     3     7     1 ;
     4     2     4     2     2     5     5     6 ;
     2     4     4     7     4     4     2     7 ;
     7     4     2     3     6     4     7     1 ;
     4     6     4     2     5     5     1     4];
y_correct = 0;
assert(isequal(match_three(x),y_correct))

                    
2
Pass
 
%%
x=mod(magic(4),4);
y_correct = 0;
assert(isequal(match_three(x),y_correct))

                    
3
Pass
 
%%
x=mod(magic(7),2);
y_correct = 1;
assert(isequal(match_three(x),y_correct))

                    
4
Pass
 
%%
x=[5 2 3 ; 5 3 2 ; 5 4 1] ;
y_correct = 1;
assert(isequal(match_three(x),y_correct))

                    
5
Pass
 
%%
x=[  3     3     4     2     1     3     1
     5     4     3     1     6     1     5
     3     6     1     2     3     1     5
     3     3     2     5     6     3     1
     3     6     5     3     1     5     6
     4     2     4     2     4     3     3
     2     6     5     1     5     1     4];
y_correct = 1;
assert(isequal(match_three(x),y_correct))

                    
6
Pass
 
%%
x=[ 1 1 1 ; 4 2 3 ; 2 3 4];
y_correct = 1;
assert(isequal(match_three(x),y_correct))