30. Longest Valid Parentheses
Given a string containing only parentheses, return the length of the longest valid parentheses substring.
Example 1:
Input: s = "(()" Output: 2
Example 2:
Input: s = ")()())" Output: 4
Constraints:
0 <= s.length <= 3 * 10^4