标签:
Given a string that contains only digits 0-9
and a target value, return all possibilities to add operators +
, -
, 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"] "00", 0 -> ["0+0", "0-0", "0*0"] "3456237490", 9191 -> []
Credits:
Special thanks to @davidtan1890 for adding this problem and creating all test cases.
[LeetCode] Expression Add Operators 表达式增加操作符
标签:
原文地址:http://www.cnblogs.com/grandyang/p/4814506.html