Overview
Given a list of digits, find the fewest operations to make 100
Input
A string of digits, which may or may not be in numerical order. The order of the digits cannot be changed, however plus (+) or minus (-) operators may be added between each so that the total sum is equal to 100.
Output
The number of operators added, followed by the full sequence of digits and operators. The two can be separated by a space, tab, or new line sequence.
Examples
valid
Input: 123456789
Output: 3 123–45–67+89
Invalid
Input: 123456789
Output:
6
1+2+34-5+67-8+9
(There are ways of solving this with fewer operations)
+
and-
? Can we assume we will always be able to make100
from the input? \$\endgroup\$299399
, would-299+399
be valid? \$\endgroup\$