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 "()()"
import java.util.Stack;
/**
* <p>Title: </p>
* <p>Description: </p>
*
* @CreateTime 2019/1/6 14:07
*/
public class Leetcode_32_LongestValidParentheses {