Manraj-Mann / Hacktoberfest-DSA-Codes

Add the DSA codes in any language in defined folder to maintain a repository to help students learn DSA
9 stars 52 forks source link

code for longest valid parantheses #79

Open joyeta148 opened 1 year ago

joyeta148 commented 1 year ago

Example 1:

Input: s = "(()" Output: 2 Explanation: The longest valid parentheses substring is "()".

Example 2:

Input: s = ")()())" Output: 4 Explanation: The longest valid parentheses substring is "()()".

Example 3:

Input: s = "" Output: 0