计算表达式的值 ()=1 (A)=A 2 AB=A+B 1 表达式只有() 可以将所有的() 替换为1 然后给每一个1 乘上相应的权重,累加即可 2 使用栈结构 遇到( 就压栈一个0 遇到 ) 就出栈一个 v 同时压栈一个 max(2 v,1) 因为如果是() 的话 ,当时压栈的是0 这里要给这个表 ...
分类:
其他好文 时间:
2018-09-03 12:03:49
阅读次数:
152
Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. Th ...
分类:
其他好文 时间:
2018-08-31 10:42:38
阅读次数:
202
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: No ...
分类:
其他好文 时间:
2018-08-25 11:42:25
阅读次数:
145
301. Remove Invalid Parentheses https://leetcode.com/problems/remove-invalid-parentheses/discuss/75032/Share-my-Java-BFS-solution Time complexity anal... ...
分类:
其他好文 时间:
2018-08-17 00:43:58
阅读次数:
150
栈是一种后进先出的线性数据结构 1.栈的应用: (1)撤销--编辑器 (2)程序调用的系统栈--操作系统 (3)括号匹配--编译器(https://leetcode-cn.com/problems/valid-parentheses/description/) 给定一个只包括 '(',')','{' ...
分类:
其他好文 时间:
2018-08-17 00:39:58
阅读次数:
136
Parentheses Matrix Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0S ...
分类:
其他好文 时间:
2018-08-15 18:36:35
阅读次数:
149
这道题想不出来是因为没有抽象出他的数学模型——对于每一个位置,前面左括号的个数都大于等于右括号个数。 ...
分类:
其他好文 时间:
2018-08-12 20:01:04
阅读次数:
105