这个题目leetcode上提示用动态规划,但是那样要O(n^2)。我自己想出了一个O(n)的算法,并提交通过。【题目】Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
For "((...
分类:
编程语言 时间:
2015-05-06 11:00:58
阅读次数:
123
题目:
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-05-05 14:29:11
阅读次数:
172
题目:
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...
分类:
其他好文 时间:
2015-05-05 10:35:05
阅读次数:
144
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-05-03 17:18:23
阅读次数:
121
题目描述
Given a string containing just the characters '(', ')', '{', '}', '[' and ']',
determine if the input string is valid.
The brackets must close in the correct order, "()" and "()[]{}" ar...
分类:
其他好文 时间:
2015-05-03 14:42:13
阅读次数:
193
Longest Valid Parentheses
Given a string containing just the characters '(' and ')',
find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid pa...
分类:
其他好文 时间:
2015-04-29 15:06:06
阅读次数:
126
??
问题描述:Given n pairs of parentheses, write a function to generate allcombinations of well-formed
parentheses.
For example, given n = 3, a solution setis:
"((()))","(()())", "(())()", "()((...
分类:
其他好文 时间:
2015-04-28 18:34:13
阅读次数:
112
[Java] LeetCode32 Longest Valid Parentheses...
分类:
编程语言 时间:
2015-04-28 11:56:33
阅读次数:
125
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-04-25 11:58:22
阅读次数:
95
题目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 “()”, which h...
分类:
其他好文 时间:
2015-04-23 21:49:15
阅读次数:
156