Cody

Problem 2318. Combine Cards to make 21

Solution 2652431

Submitted on 4 Jul 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)))

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

Assertion failed.

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

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

Assertion failed.

Suggested Problems

Community Treasure Hunt

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

Start Hunting!