Longest Valid Parentheses

Hard

📝 Description

Find length of longest valid (well-formed) parentheses substring

Input Format

String of parentheses

Output Format

Length

Constraints

0 ≤ s.length ≤ 3 * 10^4

🔍 Sample Input

")()())"
            

✅ Sample Output

4
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run