题目: Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators
分类:
其他好文 时间:
2016-02-02 18:50:56
阅读次数:
217
基础题目 建一个堆栈,对于这个字符串,如果是左括号就放到堆栈里面,如果是右括号,就弹出堆栈里的一个元素,如果此时堆栈是空的,肯定是不匹配的,如果弹出的不匹配,也返回false。做完以后看堆栈是不是正好的空的,如果是空的就返回true,否则就是false。 1 public boolean isVal
分类:
其他好文 时间:
2016-01-28 09:24:42
阅读次数:
148
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ...
分类:
其他好文 时间:
2016-01-27 14:30:10
阅读次数:
212
Implement a basic calculator to evaluate a simple expression string.The expression string may contain open(and closing parentheses), the plus+or minus...
分类:
其他好文 时间:
2016-01-16 16:36:16
阅读次数:
143
Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))...
分类:
其他好文 时间:
2016-01-10 23:58:07
阅读次数:
392
Valid Parentheses:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets m...
分类:
其他好文 时间:
2016-01-08 23:24:33
阅读次数:
214
LeetCode解题之Generate Parentheses原题罗列出n组括号的所有合法的排列组合。...
分类:
其他好文 时间:
2015-12-23 09:27:42
阅读次数:
122
题目:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in th...
分类:
其他好文 时间:
2015-12-20 09:17:28
阅读次数:
162
22. Generate ParenthesesTotal Accepted:70039Total Submissions:203043Difficulty:MediumGivennpairs of parentheses, write a function to generate all comb...
分类:
其他好文 时间:
2015-12-19 23:06:33
阅读次数:
227
class Solution(object): def longestValidParentheses(self, s): """ :type s: str :rtype: int """ maxlen=0 s...
分类:
编程语言 时间:
2015-12-16 00:23:48
阅读次数:
221