Cody

# Problem 2318. Combine Cards to make 21

Solution 1710914

Submitted on 20 Jan 2019 by Mark McBroom
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
cards = 'A3762'; mathSymbols = {'+-*/'}; assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

21! .... cards:A3762 operators: 0123

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

21! .... cards:A23QJK operators: 01300

3   Pass
cards = '923'; mathSymbols = {'*+', '-*'}; assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

21! .... cards:923 operators: 12 21! .... cards:923 operators: 20

4   Pass
cards = 'A23456'; mathSymbols = {'**+++', '*+*-+', '*-+*+', '+++++', '+++-+', '-+/*+', '--+++', '/-*++', '/--+*'}; assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

21! .... cards:A23456 operators: 00000 21! .... cards:A23456 operators: 20210 21! .... cards:A23456 operators: 21020 21! .... cards:A23456 operators: 22000 21! .... cards:A23456 operators: 00010 21! .... cards:A23456 operators: 10320 21! .... cards:A23456 operators: 11000 21! .... cards:A23456 operators: 31102 21! .... cards:A23456 operators: 31200

5   Pass
cards = 'JQKA'; mathSymbols = {'*/+', '+-+', '-++', '/*+'}; assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

21! .... cards:JQKA operators: 010 21! .... cards:JQKA operators: 100 21! .... cards:JQKA operators: 230 21! .... cards:JQKA operators: 320

6   Pass
cards = 'KA'; mathSymbols = {'+'}; assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

21! .... cards:KA operators: 0

7   Pass
cards = 'AAA'; mathSymbols = {'+-','-+'}; assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

21! .... cards:AAA operators: 10 21! .... cards:AAA operators: 01