Cody

# Problem 2225. Three...is a magic number.

Solution 960833

Submitted on 6 Sep 2016 by Vishal
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
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))

get = 1 7 1 get = 7 1 6 get = 1 6 4 get = 6 4 2 get = 4 2 7 get = 2 7 4 get = 2 7 6 get = 7 6 6 get = 6 6 2 get = 6 2 4 get = 2 4 4 get = 4 4 6 get = 7 5 5 get = 5 5 7 get = 5 7 4 get = 7 4 4 get = 4 4 2 get = 4 2 4 get = 6 3 4 get = 3 4 4 get = 4 4 2 get = 4 2 7 get = 2 7 3 get = 7 3 2 get = 7 5 3 get = 5 3 6 get = 3 6 2 get = 6 2 4 get = 2 4 6 get = 4 6 5 get = 2 3 5 get = 3 5 3 get = 5 3 5 get = 3 5 4 get = 5 4 4 get = 4 4 5 get = 7 2 7 get = 2 7 7 get = 7 7 5 get = 7 5 2 get = 5 2 7 get = 2 7 1 get = 7 5 5 get = 5 5 1 get = 5 1 6 get = 1 6 7 get = 6 7 1 get = 7 1 4 get = 1 2 7 get = 2 7 6 get = 7 6 7 get = 6 7 2 get = 7 2 7 get = 2 7 7 get = 7 7 5 get = 7 5 3 get = 5 3 5 get = 3 5 3 get = 5 3 2 get = 3 2 5 get = 1 6 5 get = 6 5 4 get = 5 4 3 get = 4 3 5 get = 3 5 7 get = 5 7 5 get = 6 6 7 get = 6 7 4 get = 7 4 6 get = 4 6 3 get = 6 3 7 get = 3 7 1 get = 4 2 4 get = 2 4 2 get = 4 2 2 get = 2 2 5 get = 2 5 5 get = 5 5 6 get = 2 4 4 get = 4 4 7 get = 4 7 4 get = 7 4 4 get = 4 4 2 get = 4 2 7 get = 7 4 2 get = 4 2 3 get = 2 3 6 get = 3 6 4 get = 6 4 7 get = 4 7 1 get = 4 6 4 get = 6 4 2 get = 4 2 5 get = 2 5 5 get = 5 5 1 get = 5 1 4

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

get = 0 1 1 get = 1 1 0 get = 2 3 3 get = 3 3 2 get = 3 2 2 get = 2 2 3 get = 1 0 0 get = 0 0 1 get = 0 2 3 get = 2 3 1 get = 1 3 2 get = 3 2 0 get = 1 3 2 get = 3 2 0 get = 0 2 3 get = 2 3 1

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

get = 0 0 0 get = 0 0 1 get = 0 1 1 get = 1 1 1 get = 1 1 0 get = 1 1 0 get = 1 0 0 get = 0 0 1 get = 0 1 1 get = 1 1 1 get = 0 1 0 get = 1 0 0 get = 0 0 0 get = 0 0 0 get = 0 0 0 get = 1 1 1 get = 1 1 1 get = 1 1 1 get = 1 1 1 get = 1 1 1 get = 0 0 0 get = 0 0 0 get = 0 0 0 get = 0 0 1 get = 0 1 0 get = 1 1 1 get = 1 1 0 get = 1 0 0 get = 0 0 1 get = 0 1 1 get = 0 1 1 get = 1 1 1 get = 1 1 0 get = 1 0 0 get = 0 0 0 get = 0 1 0 get = 1 0 1 get = 0 1 0 get = 1 0 1 get = 0 1 0 get = 0 1 1 get = 1 1 1 get = 1 1 0 get = 1 0 1 get = 0 1 1 get = 0 0 0 get = 0 0 1 get = 0 1 0 get = 1 0 1 get = 0 1 1 get = 1 0 0 get = 0 0 1 get = 0 1 0 get = 1 0 0 get = 0 0 1 get = 1 1 0 get = 1 0 1 get = 0 1 0 get = 1 0 0 get = 0 0 0 get = 1 1 0 get = 1 0 1 get = 0 1 1 get = 1 1 1 get = 1 1 0 get = 0 1 0 get = 1 0 1 get = 0 1 0 get = 1 0 1 get = 0 1 0

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

get = 5 5 5 get = 2 3 4 get = 3 2 1 get = 5 2 3 get = 5 3 2 get = 5 4 1

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

get = 3 5 3 get = 5 3 3 get = 3 3 3 get = 3 3 4 get = 3 4 2 get = 3 4 6 get = 4 6 3 get = 6 3 6 get = 3 6 2 get = 6 2 6 get = 4 3 1 get = 3 1 2 get = 1 2 5 get = 2 5 4 get = 5 4 5 get = 2 1 2 get = 1 2 5 get = 2 5 3 get = 5 3 2 get = 3 2 1 get = 1 6 3 get = 6 3 6 get = 3 6 1 get = 6 1 4 get = 1 4 5 get = 3 1 1 get = 1 1 3 get = 1 3 5 get = 3 5 3 get = 5 3 1 get = 1 5 5 get = 5 5 1 get = 5 1 6 get = 1 6 3 get = 6 3 4 get = 3 3 4 get = 3 4 2 get = 4 2 1 get = 2 1 3 get = 1 3 1 get = 5 4 3 get = 4 3 1 get = 3 1 6 get = 1 6 1 get = 6 1 5 get = 3 6 1 get = 6 1 2 get = 1 2 3 get = 2 3 1 get = 3 1 5 get = 3 3 2 get = 3 2 5 get = 2 5 6 get = 5 6 3 get = 6 3 1 get = 3 6 5 get = 6 5 3 get = 5 3 1 get = 3 1 5 get = 1 5 6 get = 4 2 4 get = 2 4 2 get = 4 2 4 get = 2 4 3 get = 4 3 3 get = 2 6 5 get = 6 5 1 get = 5 1 5 get = 1 5 1 get = 5 1 4

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

get = 1 4 2 get = 1 2 3 get = 1 3 4 get = 1 1 1 get = 4 2 3 get = 2 3 4

7   Pass
x=[ 1 2 3 ; 4 5 6 ; 7 8 9]; y_correct = 0; assert(isequal(match_three(x),y_correct))

get = 1 4 7 get = 2 5 8 get = 3 6 9 get = 1 2 3 get = 4 5 6 get = 7 8 9

8   Pass
x=[ 1 1 1 1 ; 2 4 6 8 ; 3 6 9 12 ; 4 8 12 16]; y_correct = 1; assert(isequal(match_three(x),y_correct))

get = 1 2 3 get = 2 3 4 get = 1 4 6 get = 4 6 8 get = 1 6 9 get = 6 9 12 get = 1 8 12 get = 8 12 16 get = 1 1 1 get = 1 1 1 get = 2 4 6 get = 4 6 8 get = 3 6 9 get = 6 9 12 get = 4 8 12 get = 8 12 16

9   Pass
x=[ 1 5 7 9 ; 1 5 7 9 ; 2 4 6 8 ; 1 5 7 9]; y_correct = 0; assert(isequal(match_three(x),y_correct))

get = 1 1 2 get = 1 2 1 get = 5 5 4 get = 5 4 5 get = 7 7 6 get = 7 6 7 get = 9 9 8 get = 9 8 9 get = 1 5 7 get = 5 7 9 get = 1 5 7 get = 5 7 9 get = 2 4 6 get = 4 6 8 get = 1 5 7 get = 5 7 9