Cody

# Problem 2318. Combine Cards to make 21

Solution 2402863

Submitted on 28 May 2020
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   Fail
cards = 'A3762'; mathSymbols = {'+-*/'}; assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

t = 1 2 3 4 q = 1×3 logical array 0 0 0

Error using strcat (line 46) Inputs must be character vectors, cell arrays of character vectors, or string arrays. Error in solveBlackjackPuzzle (line 55) q=strcat(q,'/') Error in Test1 (line 3) assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

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

t = 1 2 4 1 1 q = '+-/'

Output argument "mathSyms" (and maybe others) not assigned during call to "solveBlackjackPuzzle". Error in Test2 (line 3) assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

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

t = 2 3 q = 1×2 logical array 0 0 t = 3 1 q = logical 0

Error using strcat (line 46) Inputs must be character vectors, cell arrays of character vectors, or string arrays. Error in solveBlackjackPuzzle (line 49) q=strcat(q,'+'); Error in Test3 (line 3) assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

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

t = 1 1 1 1 1 t = 1 1 1 2 1 t = 2 1 4 3 1 q = '-+/' q = 1×4 logical array 0 0 0 0

Error using strcat (line 46) Inputs must be character vectors, cell arrays of character vectors, or string arrays. Error in solveBlackjackPuzzle (line 49) q=strcat(q,'+'); Error in Test4 (line 3) assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

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

t = 1 2 1 t = 2 1 1 t = 3 4 1 q = logical 0

Error using strcat (line 46) Inputs must be character vectors, cell arrays of character vectors, or string arrays. Error in solveBlackjackPuzzle (line 55) q=strcat(q,'/') Error in Test5 (line 3) assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

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

t = 1

Output argument "mathSyms" (and maybe others) not assigned during call to "solveBlackjackPuzzle". Error in Test6 (line 3) assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

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

Unrecognized function or variable 'cards1'. Error in solveBlackjackPuzzle (line 10) cards1 = str2num(cards1); Error in Test7 (line 3) assert(isequal(sort(solveBlackjackPuzzle(cards)), sort(mathSymbols)))

### Community Treasure Hunt

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

Start Hunting!