Cody

Problem 520. Choose the best fitting dominoes

Solution 3573720

Submitted on 7 Nov 2020 by Mayank Bajpai
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 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))

temp = 1 5 temp = 1 5 0 4 temp = 1 5 0 4 7 7 temp = 1 5 temp = 1 5 0 4 temp = 1 5 0 4 3 8 temp = 1 5 temp = 1 5 0 4 temp = 1 5 0 4 4 7 temp = 1 5 temp = 1 5 0 4 temp = 1 5 0 4 5 9 temp = 1 5 temp = 1 5 0 4 temp = 1 5 0 4 0 4 temp = 1 5 temp = 1 5 1 5 temp = 1 5 1 5 7 7 temp = 1 5 temp = 1 5 1 5 temp = 1 5 1 5 3 8 temp = 1 5 temp = 1 5 1 5 temp = 1 5 1 5 4 7 temp = 1 5 temp = 1 5 1 5 temp = 1 5 1 5 5 9 temp = 1 5 temp = 1 5 1 5 temp = 1 5 1 5 0 4 temp = 1 5 temp = 1 5 2 2 temp = 1 5 2 2 7 7 temp = 1 5 temp = 1 5 2 2 temp = 1 5 2 2 3 8 temp = 1 5 temp = 1 5 2 2 temp = 1 5 2 2 4 7 temp = 1 5 temp = 1 5 2 2 temp = 1 5 2 2 5 9 temp = 1 5 temp = 1 5 2 2 temp = 1 5 2 2 0 4 temp = 1 5 temp = 1 5 4 5 temp = 1 5 4 5 7 7 temp = 1 5 temp = 1 5 4 5 temp = 1 5 4 5 3 8 temp = 1 5 temp = 1 5 4 5 temp = 1 5 4 5 4 7 temp = 1 5 temp = 1 5 4 5 temp = 1 5 4 5 5 9 temp = 1 5 temp = 1 5 4 5 temp = 1 5 4 5 0 4 temp = 1 5 temp = 1 5 4 6 temp = 1 5 4 6 7 7 temp = 1 5 temp = 1 5 4 6 temp = 1 5 4 6 3 8 temp = 1 5 temp = 1 5 4 6 temp = 1 5 4 6 4 7 temp = 1 5 temp = 1 5 4 6 temp = 1 5 4 6 5 9 temp = 1 5 temp = 1 5 4 6 temp = 1 5 4 6 0 4 temp = 2 3 temp = 2 3 0 4 temp = 2 3 0 4 7 7 temp = 2 3 temp = 2 3 0 4 temp = 2 3 0 4 3 8 temp = 2 3 temp = 2 3 0 4 temp = 2 3 0 4 4 7 temp = 2 3 temp = 2 3 0 4 temp = 2 3 0 4 5 9 temp = 2 3 temp = 2 3 0 4 temp = 2 3 0 4 0 4 temp = 2 3 temp = 2 3 1 5 temp = 2 3 1 5 7 7 temp = 2 3 temp = 2 3 1 5 temp = 2 3 1 5 3 8 temp = 2 3 temp = 2 3 1 5 temp = 2 3 1 5 4 7 temp = 2 3 temp = 2 3 1 5 temp = 2 3 1 5 5 9 temp = 2 3 temp = 2 3 1 5 temp = 2 3 1 5 0 4 temp = 2 3 temp = 2 3 2 2 temp = 2 3 2 2 7 7 temp = 2 3 temp = 2 3 2 2 temp = 2 3 2 2 3 8 temp = 2 3 temp = 2 3 2 2 temp = 2 3 2 2 4 7 temp = 2 3 temp = 2 3 2 2 temp = 2 3 2 2 5 9 temp = 2 3 temp = 2 3 2 2 temp = 2 3 2 2 0 4 temp = 2 3 temp = 2 3 4 5 temp = 2 3 4 5 7 7 temp = 2 3 temp = 2 3 4 5 temp = 2 3 4 5 3 8 temp = 2 3 temp = 2 3 4 5 temp = 2 3 4 5 4 7 temp = 2 3 temp = 2 3 4 5 temp = 2 3 4 5 5 9 temp = 2 3 temp = 2 3 4 5 temp = 2 3 4 5 0 4 temp = 2 3 temp = 2 3 4 6 temp = 2 3 4 6 7 7 temp = 2 3 temp = 2 3 4 6 temp = 2 3 4 6 3 8 temp = 2 3 temp = 2 3 4 6 temp = 2 3 4 6 4 7 temp = 2 3 temp = 2 3 4 6 temp = 2 3 4 6 5 9 temp = 2 3 temp = 2 3 4 6 temp = 2 3 4 6 0 4 temp = 2 2 temp = 2 2 0 4 temp = 2 2 0 4 7 7 temp = 2 2 temp = 2 2 0 4 temp = 2 2 0 4 3 8 temp = 2 2 temp = 2 2 0 4 temp = 2 2 0 4 4 7 temp = 2 2 temp = 2 2 0 4 temp = 2 2 0 4 5 9 temp = 2 2 temp = 2 2 0 4 temp = 2 2 0 4 0 4 temp = 2 2 temp = 2 2 1 5 temp = 2 2 1 5 7 7 temp = 2 2 temp = 2 2 1 5 temp = 2 2 1 5 3 8 temp = 2 2 temp = 2 2 1 5 temp = 2 2 1 5 4 7 temp = 2 2 temp = 2 2 1 5 temp = 2 2 1 5 5 9 temp = 2 2 temp = 2 2 1 5 temp = 2 2 1 5 0 4 temp = 2 2 temp = 2 2 2 2 temp = 2 2 2 2 7 7 temp = 2 2 temp = 2 2 2 2 temp = 2 2 2 2 3 8 temp = 2 2 temp = 2 2 2 2 temp = 2 2 2 2 4 7 temp = 2 2 temp = 2 2 2 2 temp = 2 2 2 2 5 9 temp = 2 2 temp = 2 2 2 2 temp = 2 2 2 2 0 4 temp = 2 2 temp = 2 2 4 5 temp = 2 2 4 5 7 7 temp = 2 2 temp = 2 2 4 5 temp = 2 2 4 5 3 8 temp = 2 2 temp = 2 2 4 5 temp = 2 2 4 5 4 7 temp = 2 2 temp = 2 2 4 5 temp = 2 2 4 5 5 9 temp = 2 2 temp = 2 2 4 5 temp = 2 2 4 5 0 4 temp = 2 2 temp = 2 2 4 6 temp = 2 2 4 6 7 7 temp = 2 2 temp = 2 2 4 6 temp = 2 2 4 6 3 8 temp = 2 2 temp = 2 2 4 6 temp = 2 2 4 6 4 7 temp = 2 2 temp = 2 2 4 6 temp = 2 2 4 6 5 9 temp = 2 2 temp = 2 2 4 6 temp = 2 2 4 6 0 4 temp = 3 4 temp = 3 4 0 4 temp = 3 4 0 4 7 7 temp = 3 4 temp = 3 4 0 4 temp = 3 4 0 4 3 8 temp = 3 4 temp = 3 4 0 4 temp = 3 4 0 4 4 7 temp = 3 4 temp = 3 4 0 4 temp = 3 4 0 4 5 9 temp = 3 4 temp = 3 4 0 4 temp = 3 4 0 4 0 4 temp = 3 4 temp = 3 4 1 5 temp = 3 4 1 5 7 7 temp = 3 4 temp = 3 4 1 5 temp = 3 4 1 5 3 8 temp = 3 4 temp = 3 4 1 5 temp = 3 4 1 5 4 7 temp = 3 4 temp = 3 4 1 5 temp = 3 4 1 5 5 9 temp = 3 4 temp = 3 4 1 5 temp = 3 4 1 5 0 4 temp = 3 4 temp = 3 4 2 2 temp = 3 4 2 2 7 7 temp = 3 4 temp = 3 4 2 2 temp = 3 4 2 2 3 8 temp = 3 4 temp = 3 4 2 2 temp = 3 4 2 2 4 7 temp = 3 4 temp = 3 4 2 2 temp = 3 4 2 2 5 9 temp = 3 4 temp = 3 4 2 2 temp = 3 4 2 2 0 4 temp = 3 4 temp = 3 4 4 5 temp = 3 4 4 5 7 7 temp = 3 4 temp = 3 4 4 5 temp = 3 4 4 5 3 8 temp = 3 4 temp = 3 4 4 5 temp ...

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

temp = 1 4 temp = 1 4 1 2 temp = 1 4 1 2 2 2 temp = 1 4 temp = 1 4 2 3 temp = 1 4 2 3 2 2 temp = 2 2 temp = 2 2 1 2 temp = 2 2 1 2 2 2 temp = 2 2 temp = 2 2 2 3 temp = 2 2 2 3 2 2 temp = 1 1 temp = 1 1 1 2 temp = 1 1 1 2 2 2 temp = 1 1 temp = 1 1 2 3 temp = 1 1 2 3 2 2 temp = 3 3 temp = 3 3 1 2 temp = 3 3 1 2 2 2 temp = 3 3 temp = 3 3 2 3 temp = 3 3 2 3 2 2

Suggested Problems

More from this Author52

Community Treasure Hunt

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

Start Hunting!