DescriptionYou are given a string consisting of parentheses () and []. A string of this type is said to be correct:(a)if it is the empty string(b)if A...
分类:
其他好文 时间:
2015-07-20 23:19:30
阅读次数:
171
栈Time Limit:3000MSMemory Limit:0KB64bit IO Format:%lld & %lluDescriptionYou are given a string consisting of parentheses()and[]. A string of this type...
分类:
其他好文 时间:
2015-07-20 15:48:51
阅读次数:
113
DescriptionYou are given a string consisting of parentheses()and[]. A string of this type is said to becorrect:(a)if it is the empty string(b)if A and...
分类:
其他好文 时间:
2015-07-20 09:08:36
阅读次数:
119
https://leetcode.com/problems/generate-parentheses/递归,用两个指标left和right来标记出合法规则,之后再left和right都达到n后,满足了可以输出的条件此时,就可以把这个string压入到res中了。 1 class Solution {...
分类:
其他好文 时间:
2015-07-18 16:54:24
阅读次数:
114
问题描述Implement a basic calculator to evaluate a simple expression string.The expression string may contain open ( and closing parentheses ), the plus +...
分类:
其他好文 时间:
2015-07-15 14:36:25
阅读次数:
116
题目链接:https://leetcode.com/problems/generate-parentheses/
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For example, given n = 3, a...
分类:
其他好文 时间:
2015-07-14 18:01:42
阅读次数:
106
题目链接:https://leetcode.com/problems/valid-parentheses/
Given a string containing just the characters '(', ')','{', '}', '[' and ']',
determine if the input string is valid.
The brackets m...
分类:
其他好文 时间:
2015-07-14 15:37:03
阅读次数:
109
题目:032 Longest Valid Parentheses这道题是典型的堆栈应用class Solution: # @param {string} s # @return {integer} def longestValidParentheses(self, s): ...
分类:
其他好文 时间:
2015-07-14 13:18:22
阅读次数:
102
@requires_authorization
@author johnsondu
@create_time 2015.7.13 11:03
@url [valid parentheses](https://leetcode.com/problems/valid-parentheses/)
/*****************
* 类别: 栈模拟判断
* 时间复杂度: O(n)
* 空间复杂度...
分类:
其他好文 时间:
2015-07-14 11:22:05
阅读次数:
97
Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.
If the fractional part is repeating, enclose the repeating part in parentheses.
...
分类:
其他好文 时间:
2015-07-13 10:29:56
阅读次数:
115