Back to problems

Expression Add Operators to Reach Target

Algorithm · Meta · Hard

You receive a digit-only string num and an integer target. Generate every expression formed by placing the binary operators +, -, and * between digits of num whose result equals target. Any expression containing an operand with a leading zero is invalid. Input: num: A string made up exclusively of digits target: An integer value Output: A list containing every valid expression whose evaluated result matches the target Example: Both expressions produce 8: 2 + 3 * 2 = 8, and 2…

Checking your access…