Cody

# Problem 2318. Combine Cards to make 21

Solution 458751

Submitted on 19 Jun 2014 by Guillaume
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
%% Example Case cards = 'A3762'; mathSymbols = {'+-*/'}; assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

x = -9 x = 21 x = -16 x = 44 x = -20 x = 40 x = -36 x = 84 x = -9 x = 21 x = -16 x = 44 x = -20 x = 40 x = -36 x = 84 x = -9 x = 21 x = -16 x = 44 x = -20 x = 40 x = -36 x = 84 x = -9 x = 21 x = 1.5000 x = 3.1667 x = -2.5000 x = -0.8333 x = -1 x = 2.3333 x = -0.2500 x = 0.5833 x = 1.5000 x = 3.1667 x = -2.5000 x = -0.8333 x = -1 x = 2.3333 x = -0.2500 x = 0.5833 x = 1.5000 x = 3.1667 x = -2.5000 x = -0.8333 x = -1 x = 2.3333 x = -0.2500 x = 0.5833 x = 1 x = 11 x = 6 x = 26 x = 1.5000 x = 6.5000 x = 5 x = 15 x = 1 x = 11 x = 6 x = 26 x = 1.5000 x = 6.5000 x = 5 x = 15 x = 1 x = 11 x = 6 x = 26 x = 1.5000 x = 6.5000 x = -18 x = 2 x = -4.5000 x = 0.5000 x = -7 x = 3 x = -11 x = -1 x = -18 x = 2 x = -4.5000 x = 0.5000 x = -7 x = 3 x = -11 x = -1 x = -18 x = 2 x = -4.5000 x = 0.5000 x = -9 x = 21 x = -16 x = 44 x = -20 x = 40 x = -36 x = 84 x = -9 x = 21 x = -16 x = 44 x = -20 x = 40 x = -36 x = 84 x = -9 x = 21 x = 1.5000 x = 3.1667 x = -2.5000 x = -0.8333 x = -1 x = 2.3333 x = -0.2500 x = 0.5833 x = 1.5000 x = 3.1667 x = -2.5000 x = -0.8333 x = -1 x = 2.3333 x = -0.2500 x = 0.5833 x = 1 x = 11 x = 6 x = 26 x = 1.5000 x = 6.5000 x = 5 x = 15 x = 1 x = 11 x = 6 x = 26 x = 1.5000 x = 6.5000 x = -18 x = 2 x = -4.5000 x = 0.5000 x = -7 x = 3 x = -11 x = -1 x = -18 x = 2 x = -4.5000 x = 0.5000 x = -9 x = 21 x = -16 x = 44 x = -20 x = 40 x = -36 x = 84 x = -9 x = 21 x = 1.5000 x = 3.1667 x = -2.5000 x = -0.8333 x = -1 x = 2.3333 x = -0.2500 x = 0.5833 x = 1 x = 11 x = 6 x = 26 x = 1.5000 x = 6.5000 x = -18 x = 2 x = -4.5000 x = 0.5000 x = -9 x = 21 x = 6.6667 x = 18.3333 x = 2.6667 x = 14.3333 x = 9.3333 x = 32.6667 x = 2.3333 x = 8.1667 x = 6.6667 x = 18.3333 x = 2.6667 x = 14.3333 x = 9.3333 x = 32.6667 x = 2.3333 x = 8.1667 x = 6.6667 x = 18.3333 x = 2.6667 x = 14.3333 x = 9.3333 x = 32.6667 x = 2.3333 x = 8.1667 x = 32 x = 102 x = 68 x = 208 x = 17 x = 52 x = 36 x = 106 x = 32 x = 102 x = 68 x = 208 x = 17 x = 52 x = 36 x = 106 x = 32 x = 102 x = 68 x = 208 x = 17 x = 52 x = 44 x = 184 x = 11 x = 46 x = 24 x = 94 x = 20 x = 90 x = 44 x = 184 x = 11 x = 46 x = 24 x = 94 x = 20 x = 90 x = 44 x = 184 x = 11 x = 46 x = 84 x = 294 x = 170 x = 590 x = 166 x = 586 x = 336 x = 1176 x = 84 x = 294 x = 170 x = 590 x = 166 x = 586 x = 336 x = 1176 x = 84 x = 294 x = 6.6667 x = 18.3333 x = 2.6667 x = 14.3333 x = 9.3333 x = 32.6667 x = 2.3333 x = 8.1667 x = 6.6667 x = 18.3333 x = 2.6667 x = 14.3333 x = 9.3333 x = 32.6667 x = 2.3333 x = 8.1667 x = 32 x = 102 x = 68 x = 208 x = 17 x = 52 x = 36 x = 106 x = 32 x = 102 x = 68 x = 208 x = 17 x = 52 x = 44 x = 184 x = 11 x = 46 x = 24 x = 94 x = 20 x = 90 x = 44 x = 184 x = 11 x = 46 x = 84 x = 294 x = 170 x = 590 x = 166 x = 586 x = 336 x = 1176 x = 84 x = 294 x = 6.6667 x = 18.3333 x = 2.6667 x = 14.3333 x = 9.3333 x = 32.6667 x = 2.3333 x = 8.1667 x = 32 x = 102 x = 68 x = 208 x = 17 x = 52 x = 44 x = 184 x = 11 x = 46 x = 84 x = 294 x = 4.5714 x = 6 x = 13.1429 x = 16 x = 3.2857 x = 4 x = 8.5714 x = 10 x = 4.5714 x = 6 x = 13.1429 x = 16 x = 3.2857 x = 4 x = 8.5714 x = 10 x = 4.5714 x = 6 x = 13.1429 x = 16 x = 3.2857 x = 4 x = -10.8571 x = -8 x = -2.7143 x = -2 x = -3.4286 x = -2 x = -7.4286 x = -6 x = -10.8571 x = -8 x = -2.7143 x = -2 x = -3.4286 x = -2 x = -7.4286 x = -6 x = -10.8571 x = -8 x = -2.7143 x = -2 x = 1.7143 x = 6 x = 5.4286 x = 14 x = 1.4286 x = 10 x = 6.8571 x = 24 x = 1.7143 x = 6 x = 5.4286 x = 14 x = 1.4286 x = 10 x = 6.8571 x = 24 x = 1.7143 x = 6 x = 2.0952 x = 2.3333 x = -1.9048 x = -1.6667 x = 0.1905 x = 0.6667 x = 0.0476 x = 0.1667 x = 2.0952 x = 2.3333 x = -1.9048 x = -1.6667 x = 0.1905 x = 0.6667 x = 0.0476 x = 0.1667 x = 4.5714 x = 6 x = 13.1429 x = 16 x = 3.2857 x = 4 x = 8.5714 x = 10 x = 4.5714 x = 6 x = 13.1429 x = 16 x = 3.2857 x = 4 x = -10.8571 x = -8 x = -2.7143 x = -2 x = -3.4286 x = -2 x = -7.4286 x = -6 x = -10.8571 x = -8 x = -2.7143 x = -2 x = 1.7143 x = 6 x = 5.4286 x = 14 x = 1.4286 x = 10 x = 6.8571 x = 24 x = 1.7143 x = 6 x = 2.0952 x = 2.3333 x = -1.9048 x = -1.6667 x = 0.1905 x = 0.6667 x = 0.0476 x = 0.1667 x = 4.5714 x = 6 x = 13.1429 x = 16 x = 3.2857 x = 4 x = -10.8571 x = -8 x = -2.7143 x = -2 x = 1.7143 x = 6 x = 10 x = 30 x = 2.5000 x = 7.5000 x = 7 x = 17 x = 3 x = 13 x = 10 x = 30 x = 2.5000 x = 7.5000 x = 7 x = 17 x = 3 x = 13 x = 10 x = 30 x = 2.5000 x = 7.5000 x = 33 x = 63 x = 68 x = 128 x = 64 x = 124 x = 132 x = 252 x = 33 x = 63 x = 68 x = 128 x = 64 x = 124 x = 132 x = 252 x = 33 x = 63 x = 3.8333 x = 5.5000 x = -0.1667 x = 1.5000 x = 3.6667 x = 7 x = 0.9167 x = 1.7500 x = 3.8333 x = 5.5000 x = -0.1667 x = 1.5000 x = 3.6667 x = 7 x = 0.9167 x = 1.7500 x = 15 x = 25 x = 34 x = 54 x = 8.5000 x = 13.5000 x = 19 x = 29 x = 15 x = 25 x = 34 x = 54 x = 8.5000 x = 13.5000 x = 10 x = 30 x = 2.5000 x = 7.5000 x = 7 x = 17 x = 3 x = 13 x = 10 x = 30 x = 2.5000 x = 7.5000 x = 33 x = 63 x = 68 x = 128 x = 64 x = 124 x = 132 x = 252 x = 33 x = 63 x = 3.8333 x = 5.5000 x = -0.1667 x = 1.5000 x = 3.6667 x = 7 x = 0.9167 x = 1.7500 x = 15 x = 25 x = 34 x = 54 x = 8.5000 x = 13.5000 x = 10 x = 30 x = 2.5000 x = 7.5000 x = 33 x = 63 x = -9 x = 21 x = -16 x = 44 x = -20 x = 40 x = -36 x = 84 x = -9 x = 21 x = -16 x = 44 x = -20 x = 40 x = -36 x = 84 x = -9 x = 21 x = 1.5000 x = 3.1667 x = -2.5000 x = -0.8333 x = -1 x = 2.3333 x = -0.2500 x = 0.5833 x = 1.5000 x = 3.1667 x = -2.5000 x = -0.8333 x = -1 x = 2.3333 x = -0.2500 x = 0.5833 x = 1 x = 11 x = 6 x = 26 x = 1.5000 x = 6.5000 x = 5 x = 15 x = 1 x = 11 x = 6 x = 26 x = 1.5000 x = 6.5000 x = -18 x = 2 x = -4.5000 x = 0.5000 x = -7 x = 3 x = -11 x = -1 x = -18 x = 2 x = -4.5000 x = 0.5000 x = -9 x = 21 x = -16 x = 44 x = -20 x = 40 x = -36 x = 84 x = -9 x = 21 x = 1.5000 x = 3.1667 x = -2.5000 x = -0.8333 x = -1 x = 2.3333 x = -0.2500 x = 0.5833 x = 1 x = 11 x = 6 x = 26 x = 1.5000 x = 6.5000 x = -18 x = 2 x = -4.5000 x = 0.5000 x = -9 x = 21 x = 6.6667 x = 18.3333 x = 2.6667 x = 14.3333 x = 9.3333 x = 32.6667 x = 2.3333 x = 8.1667 x = 6.6667 x = 18.3333 x = 2.6667 x = 14.3333 x = 9.3333 x = 32.6667 x = 2.3333 x = 8.1667 x = 32 x = 102 x = 68 x = 208 x = 17 x = 52 x = 36 x = 106 x = 32 x = 102 x = 68 x = 208 x = 17 x = 52 x = 44 x = 184 x = 11 x = 46 x = 24 x = 94 x = 20 x = 90 x = 44 x = 184 x = 11 x = 46 x = 84 x = 294 x = 170 x = 590 x = 166 x = 586 x = 336 x = 1176 x = 84 x = 294 x = 6.6667 x = 18.3333 x = 2.6667 x = 14.3333 x = 9.3333 x = 32.6667 x = 2.3333 x = 8.1667 x = 32 x = 102 x = 68 x = 208 x = 17 x = 52 x = 44 x = 184 x = 11 x = 46 x = 84 x = 294 x = 4.5714 x = 6 x = 13.1429 x = 16 x = 3.2857 x = 4 x = 8.5714 x = 10 x = 4.5714 x = 6 x = 13.1429 x = 16 x = 3.2857 x = 4 x = -10.8571 x = -8 x = -2.7143 x = -2 x = -3.4286 x = -2 x = -7.4286 x = -6 x = -10.8571 x = -8 x = -2.7143 x = -2 x = 1.7143 x = 6 x = 5.4286 x = 14 x = 1.4286 x = 10 x = 6.8571 x = 24 x = 1.7143 x = 6 x = 2.0952 x = 2.3333 x = -1.9048 x = -1.6667 x = 0.1905 x = 0.6667 x = 0.0476 x = 0.1667 x = 4.5714 x = 6 x = 13.1429 x = 16 x = 3.2857 x = ...

2   Fail
%% cards = 'A23QJK'; mathSymbols = {'+-/++'}; assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

x = 10 x = 20 x = -10 x = 0 x = 0 x = 100 x = 0 x = 1 x = 10 x = 20 x = -10 x = 0 x = 0 x = 100 x = 0 x = 1 x = 10 x = 20 x = -10 x = 0 x = 0 x = 100 x = 0 x = 1 x = 10 x = 20 x = -10 x = 0 x = 0 x = 100 x = 0 x = 1 x = 0 x = 100 x = 100 x = 1100 x = 1 x = 11 x = 20 x = 120 x = 0 x = 100 x = 100 x = 1100 x = 1 x = 11 x = 20 x = 120 x = 0 x = 100 x = 100 x = 1100 x = 1 x = 11 x = 20 x = 120 x = 0 x = 100 x = 100 x = 1100 x = 1 x = 11 x = -100 x = 900 x = -1 x = 9 x = 0 x = 100 x = -20 x = 80 x = -100 x = 900 x = -1 x = 9 x = 0 x = 100 x = -20 x = 80 x = -100 x = 900 x = -1 x = 9 x = 0 x = 100 x = -20 x = 80 x = -100 x = 900 x = -1 x = 9 x = 0 x = 100 x = 10 x = 1010 x = -10 x = 990 x = 0 x = 10000 x = 0 x = 100 x = 10 x = 1010 x = -10 x = 990 x = 0 x = 10000 x = 0 x = 100 x = 10 x = 1010 x = -10 x = 990 x = 0 x = 10000 x = 0 x = 100 x = 10 x = 20 x = -10 x = 0 x = 0 x = 100 x = 0 x = 1 x = 10 x = 20 x = -10 x = 0 x = 0 x = 100 x = 0 x = 1 x = 10 x = 20 x = -10 x = 0 x = 0 x = 100 x = 0 x = 1 x = 0 x = 100 x = 100 x = 1100 x = 1 x = 11 x = 20 x = 120 x = 0 x = 100 x = 100 x = 1100 x = 1 x = 11 x = 20 x = 120 x = 0 x = 100 x = 100 x = 1100 x = 1 x = 11 x = -100 x = 900 x = -1 x = 9 x = 0 x = 100 x = -20 x = 80 x = -100 x = 900 x = -1 x = 9 x = 0 x = 100 x = -20 x = 80 x = -100 x = 900 x = -1 x = 9 x = 0 x = 100 x = 10 x = 1010 x = -10 x = 990 x = 0 x = 10000 x = 0 x = 100 x = 10 x = 1010 x = -10 x = 990 x = 0 x = 10000 x = 0 x = 100 x = 10 x = 20 x = -10 x = 0 x = 0 x = 100 x = 0 x = 1 x = 10 x = 20 x = -10 x = 0 x = 0 x = 100 x = 0 x = 1 x = 0 x = 100 x = 100 x = 1100 x = 1 x = 11 x = 20 x = 120 x = 0 x = 100 x = 100 x = 1100 x = 1 x = 11 x = -100 x = 900 x = -1 x = 9 x = 0 x = 100 x = -20 x = 80 x = -100 x = 900 x = -1 x = 9 x = 0 x = 100 x = 10 x = 1010 x = -10 x = 990 x = 0 x = 10000 x = 0 x = 100 x = 10 x = 20 x = -10 x = 0 x = 0 x = 100 x = 0 x = 1 x = 0 x = 100 x = 100 x = 1100 x = 1 x = 11 x = -100 x = 900 x = -1 x = 9 x = 0 x = 100 x = 0 x = 1 x = 100 x = 110 x = 1 x = 1.1000 x = 20 x = 21 x = 0 x = 1 x = 100 x = 110 x = 1 x = 1.1000 x = 20 x = 21 x = 0 x = 1 x = 100 x = 110 x = 1 x = 1.1000 x = 20 x = 21 x = 0 x = 1 x = 100 x = 110 x = 1 x = 1.1000 x = -100 x = -90 x = -1 x = -0.9000 x = 0 x = 1 x = -20 x = -19 x = -100 x = -90 x = -1 x = -0.9000 x = 0 x = 1 x = -20 x = -19 x = -100 x = -90 x = -1 x = -0.9000 x = 0 x = 1 x = -20 x = -19 x = -100 x = -90 x = -1 x = -0.9000 x = 0 x = 1 x = 10 x = 20 x = -10 x = 0 x = 0 x = 100 x = 0 x = 1 x = 10 x = 20 x = -10 x = 0 x = 0 x = 100 x = 0 x = 1 x = 10 x = 20 x = -10 x = 0 x = 0 x = 100 x = 0 x = 1 x = 10 x = 10.1000 x = -10 x = -9.9000 x = 0 x = 1 x = 0 x = 0.0100 x = 10 x = 10.1000 x = -10 x = -9.9000 x = 0 x = 1 x = 0 x = 0.0100 x = 10 x = 10.1000 x = -10 x = -9.9000 x = 0 x = 1 x = 0 x = 0.0100 x = 0 x = 1 x = 100 x = 110 x = 1 x = 1.1000 x = 20 x = 21 x = 0 x = 1 x = 100 x = 110 x = 1 x = 1.1000 x = 20 x = 21 x = 0 x = 1 x = 100 x = 110 x = 1 x = 1.1000 x = -100 x = -90 x = -1 x = -0.9000 x = 0 x = 1 x = -20 x = -19 x = -100 x = -90 x = -1 x = -0.9000 x = 0 x = 1 x = -20 x = -19 x = -100 x = -90 x =

### Community Treasure Hunt

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

Start Hunting!