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
Java
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:
1≤num.length≤10
num consists of only digits.
−231≤target≤231−1
Input
arr ={"num":"123","target":6}
Find expressions that evaluate to 6 using digits "123"