Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
The brackets must close in the correct order, "()" and "()...
分类:
其他好文 时间:
2015-07-06 17:52:27
阅读次数:
155
Time Limit:1000MSMemory Limit:10000KTotal Submissions:22764Accepted:13344DescriptionLet S = s1 s2...s2n be a well-formed string of parentheses. S can ...
分类:
其他好文 时间:
2015-07-04 12:34:35
阅读次数:
97
Generate Parentheses:
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For example, given n = 3, a solution set is:
"((()))", "(()())"...
分类:
其他好文 时间:
2015-07-03 09:22:17
阅读次数:
142
题目:
Implement a basic calculator to evaluate a simple expression string.
The expression string may contain open ( and closing parentheses ),
the plus + or minus sign -, non-negative integers...
分类:
编程语言 时间:
2015-07-03 09:20:19
阅读次数:
143
Given a string containing just the characters '(' and ')',
find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid parentheses substring is "()",
...
分类:
其他好文 时间:
2015-07-03 00:20:43
阅读次数:
143
题目:Basic CalculatorImplement a basic calculator to evaluate a simple expression string.The expression string may contain open(and closing parentheses)...
分类:
其他好文 时间:
2015-07-02 17:04:09
阅读次数:
109
Description:Implement a basic calculator to evaluate a simple expression string.The expression string may contain open ( and closing parentheses ), th...
分类:
其他好文 时间:
2015-07-02 00:57:30
阅读次数:
125
这道题好理解,但是要自己想的话还是很难想出来的,动态规划说白了就是记录当前的结果,留给后面的用。求最长合法匹配的长度,这道题可以用一维动态规划逆向求解。假设输入括号表达式为String s,维护一个长度为s.length的一维数组dp[],数组元素初始化为0。 dp[i]表示从s[i]到s[s.le...
分类:
其他好文 时间:
2015-07-01 15:45:27
阅读次数:
124
Given a string containing just the characters
'(', ')', '{', '}', '[' and
']', determine if the input string is valid.
The brackets must close in the correct order,
"()" and "()[]{}" are all val...
分类:
其他好文 时间:
2015-06-30 23:40:25
阅读次数:
285
#14 Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.
这个题求多个字符串的公共前缀,除了要考虑串空外,如果存在公共前缀,那么必定也是第一个串的前缀。
所以可以以第一个串为基准,比较其他串的前缀是否与第一个串相同。
c...
分类:
其他好文 时间:
2015-06-23 11:55:01
阅读次数:
129