[LeetCode 282] Expression Add Operators
Given a string that contains only digits 0-9 and a target value, return all possibilities to
add binary operators (not unary) +
, -
, or *
between the digits so they evaluate to the target value.
Examples:
"123", 6 -> ["1+2+3", "1*2*3"]
"232", 8 -> ["2*3+2", "2+3*2"]
"105", 5 -> ["1*0+5","10-5"]
"00", 0 -> ["0+0", "0-0", "0*0"]
"3456237490", 9191 -> []
Examples:
"123", 6 -> ["1+2+3", "1*2*3"]
"232", 8 -> ["2*3+2", "2+3*2"]
"00", 0 -> ["0+0", "0-0", "0*0"]
"3456237490", 9191 -> []
DiffcultyHard
Similar Problems
[LeetCode 251] Evaluate Reverse Polish Notation Medium
[LeetCode 251] Basic Calculator Hard
[LeetCode 251] Basic Calculator II Medium
[LeetCode 251] Different Ways to Add Parentheses Medium