A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© sandwicher 初级黑马   /  2015-10-11 22:30  /  262 人查看  /  1 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

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 -> []

1 个回复

倒序浏览
这样怎么能赚到分呢
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马