Expression Add Operators
Problem Given a string of digits and a target value, insert the binary operators +, -, and * between digits (multi-digit operands allowed, but no leading zeros) so the resulting expression evaluates to the target. Return all such expressions.
Input / Output
- Input: digit string
num, integertarget. - Output: all valid operator insertions as strings.
Constraints
- 1 ≤ |num| ≤ 10.
- Operands may span multiple digits but must not have a leading zero.
Example
- num = "123", target = 6 → ["1+2+3","123"]; num = "232", target = 8 → ["23+2","2+32"].
added …