Cody

# Problem 520. Choose the best fitting dominoes

Solution 594247

Submitted on 10 Mar 2015 by Dan Brackmann
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
list = {[1 3; 2 4; 5 6],[4 6; 2 5;6 7],[3 4; 6 1; 4 6]} selections = [2 1 2]; assert(isequal(ChooseBestFittingDominoes(list),selections))

list = [3x2 double] [3x2 double] [3x2 double] cels = [1x3 double] cels = [1x3 double] [1x3 double] cels = [1x3 double] [1x3 double] [1x3 double] cels = [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Column 7 [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 8 [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 9 [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 10 [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 11 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Column 13 [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 14 [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 15 [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 16 [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 17 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Column 19 [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 20 [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 21 [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 22 [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 23 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 24 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 24 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Column 25 [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 24 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 25 through 26 [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 24 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 25 through 27 [1x3 double] [1x3 double] [1x3 double]

2   Pass
%% list = {[1 5; 2 3; 2 2; 3 4; 0 3], [0 4; 1 5; 2 2; 4 5; 4 6], [7 7; 3 8; 4 7; 5 9; 0 4]}; selections = [4 4 4]; assert(isequal(ChooseBestFittingDominoes(list),selections))

cels = [1x3 double] cels = [1x3 double] [1x3 double] cels = [1x3 double] [1x3 double] [1x3 double] cels = [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Column 7 [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 8 [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 9 [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 10 [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 11 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Column 13 [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 14 [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 15 [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 16 [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 17 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Column 19 [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 20 [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 21 [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 22 [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 23 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 24 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 24 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Column 25 [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 24 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 25 through 26 [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 24 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 25 through 27 [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 24 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 25 through 28 [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 24 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 25 through 29 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 19 through 24 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 25 through 30 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 12 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 13 through 18 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double...

3   Pass
%% list = {[1 4; 2 2; 1 1; 3 3],[1 2; 2 3],[2 2]}; selections = [3 1 1]; assert(isequal(ChooseBestFittingDominoes(list),selections))

cels = [1x3 double] cels = [1x3 double] [1x3 double] cels = [1x3 double] [1x3 double] [1x3 double] cels = [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Column 7 [1x3 double] cels = Columns 1 through 6 [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] Columns 7 through 8 [1x3 double] [1x3 double]