2017-09-13 LeetCode_241 Different Ways to Add Parentheses
来源:互联网 发布:mac关闭某个程序 编辑:程序博客网 时间:2024/06/05 08:42
241. Different Ways to Add Parentheses
Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +
, -
and *
.
Example 1
Input: "2-1-1"
.
((2-1)-1) = 0(2-(1-1)) = 2
Output: [0, 2]
Example 2
Input: "2*3-4*5"
(2*(3-(4*5))) = -34((2*3)-(4*5)) = -14((2*(3-4))*5) = -10(2*((3-4)*5)) = -10(((2*3)-4)*5) = 10
Output: [-34, -14, -10, -10, 10]
Credits:
Special thanks to @mithmatt for adding this problem and creating all test cases.
阅读全文
0 0
- 2017-09-13 LeetCode_241 Different Ways to Add Parentheses
- 2017-09-13 LeetCode_241 Different Ways to Add Parentheses
- Different Ways to Add Parentheses
- Different Ways to Add Parentheses
- Different Ways to Add Parentheses
- Different Ways to Add Parentheses
- Different Ways to Add Parentheses
- Different Ways to Add Parentheses
- Different Ways to Add Parentheses
- Different Ways to Add Parentheses
- Different Ways to Add Parentheses
- Different Ways to Add Parentheses
- Different Ways to Add Parentheses
- Different Ways to Add Parentheses
- different-ways-to-add-parentheses
- Different Ways to Add Parentheses
- Different Ways to Add Parentheses
- Different Ways to Add Parentheses
- Android Edittext 显示光标 获取焦点 监听焦点
- selenium的使用
- PHP重定向的三种方法
- 开发工具笔记
- 8.3 Spring Boot集成Scala混合Java开发
- 2017-09-13 LeetCode_241 Different Ways to Add Parentheses
- 8.4 Spring Boot集成Kotlin混合Java开发
- hadoop实战随笔_0719
- 一万块的iPhone X来了,你看好苹果的黑科技吗?
- 8.5 Spring Boot集成Swagger2构建自动化Rest API文档
- 8.6 Spring Boot集成Spring Security
- 8.7 Spring Boot集成日志
- 8.8 Spring Boot静态资源处理
- 【算法】CTR预估中的贝叶斯平滑方法(一)