Expression Add Operators
Given a string num that contains only digits and an integer target, return all possible expressions by adding the binary operators +, -, or * between the digits so that the expression evaluates to the target value.

30:00

Expression Add Operators
hard
Topics
Companies

Given a string num that contains only digits and an integer target, return all possible expressions by adding the binary operators +, -, or * between the digits so that the expression evaluates to the target value.

Example 1:
Input: {"num":"123","target":6}
Output: ["1*2*3","1+2+3"]
Constraints:
  • 1num.length101 \leq \text{num.length} \leq 10

  • num consists of only digits.

  • 231target2311-2^{31} \leq \text{target} \leq 2^{31} - 1

Input
arr ={"num":"123","target":6}

Find expressions that evaluate to 6 using digits "123"

Input Number (Target: 6)

1

2

3

Valid Expressions (0)

No valid expressions found yet...

Digits: 3
Target: 6
Found: 0
Variables
No variables to display
DepthFunction Call
Stack empty
0/24