32. Longest Valid Parentheses

2018-10-27  本文已影响0人  matrxyz

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:


上一篇 下一篇

猜你喜欢

热点阅读