30. Longest Valid Parentheses
Given a string containing only parentheses, return the length of the longest valid parentheses substring.
範例 1:
輸入: s = "(()" 輸出: 2
範例 2:
輸入: s = ")()())" 輸出: 4
限制條件:
0 <= s.length <= 3 * 10^4
Given a string containing only parentheses, return the length of the longest valid parentheses substring.
輸入: s = "(()" 輸出: 2
輸入: s = ")()())" 輸出: 4
0 <= s.length <= 3 * 10^4