首页 > 其他 > 详细

[LeetCode] Expression Add Operators 表达式增加操作符

时间:2015-09-16 21:58:15      阅读:238      评论:0      收藏:0      [点我收藏+]

 

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!