Given a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parentheses substring.
Input: s = "(()"
Output: 2
Explanation: The longest valid parentheses substring is "()".
Input: s = ")()())"
Output: 4
Explanation: The longest valid parentheses substring is "()()".
Input: s = ""
Output: 0
s[i] is either '(' or ')'Test Case 1
Input : s = ")()())"
Expected Output : 4
Test Case 2
Input : s = "(()"
Expected Output : 2
Test Case 3
Input : s = ""
Expected Output : 0
DailyCode