Cody

Problem 520. Choose the best fitting dominoes

Solution 173016

Submitted on 5 Dec 2012 by Tom Holz
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] 111 211 311 121 221 321 131 231 331 112 212 312 122 222 322 132 232 332 113 213 313 123 223 323 133 233 333

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

111 211 311 411 511 121 221 321 421 521 131 231 331 431 531 141 241 341 441 541 151 251 351 451 551 112 212 312 412 512 122 222 322 422 522 132 232 332 432 532 142 242 342 442 542 152 252 352 452 552 113 213 313 413 513 123 223 323 423 523 133 233 333 433 533 143 243 343 443 543 153 253 353 453 553 114 214 314 414 514 124 224 324 424 524 134 234 334 434 534 144 244 344 444 544 154 254 354 454 554 115 215 315 415 515 125 225 325 425 525 135 235 335 435 535 145 245 345 445 545 155 255 355 455 555

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

111 211 311 411 121 221 321 421

Community Treasure Hunt

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

Start Hunting!