美文网首页
32. Longest Valid Parentheses

32. Longest Valid Parentheses

作者: matrxyz | 来源:发表于2018-10-27 07:57 被阅读0次

Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.

Example 1:
Input: "(()"
Output: 2
Explanation: The longest valid parentheses substring is "()"
Example 2:
Input: ")()())"
Output: 4
Explanation: The longest valid parentheses substring is "()()"

Solution:

思路:
http://www.cnblogs.com/grandyang/p/4424731.html

Time Complexity: O() Space Complexity: O()

Solution Code:


相关文章

网友评论

      本文标题:32. Longest Valid Parentheses

      本文链接:https://www.haomeiwen.com/subject/srvrtqtx.html