32. 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 parentheses substring is "()", which has length = 2.

Another example is ")()())", where the longest valid parentheses substring is "()()", which has length = 4.

链接: http://leetcode.com/problems/longest-valid-parentheses/

题解:

测试:

 

你可能感兴趣的:(long)