Given between two and six cards, e.g.
A _ 3 _ 7 _ 6 _ 2
place one of the mathematical symbols (+,-,*,/) in the space between each pair of cards to make the equation equal 21.
The input will be a string, e.g.
- 'A3762'
The output should be a cell array of mathematical symbols in the order that satisfies the puzzle, e.g. for the string given above, the output would be:
{'+-*/'}
Which means that A + 3 - 7 * 6 / 2 = 21.
- A + 3 = 14
- 14 - 7 = 7
- 7 * 6 = 42
- 42 / 2 = 21
Rules:
- The Ace can represent either 1 or 11.
- All operations should be performed from left to right
- Cards will be represented by the characters: A,2,3,4,5,6,7,8,9,J,Q,K
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers39
Suggested Problems
-
Return the largest number that is adjacent to a zero
5514 Solvers
-
Omit columns averages from a matrix
618 Solvers
-
Project Euler: Problem 1, Multiples of 3 and 5
3664 Solvers
-
Return fibonacci sequence do not use loop and condition
851 Solvers
-
Number of Even Elements in Fibonacci Sequence
1633 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
nice problem!, consider perhaps adding 'AAA' (with solutions {'+-','-+'}) to the testsuite to make it more challenging
Thanks for the suggestion Alfonso. That does make things a little more challenging. :)
Did you have fun this this last test case, isn't it?? XDDD
YOU... BAD GUYS!! ;-)
J,Q, and K all have value 10. This rule should be probably added to the problem description.