Problem link
Step 01: Problem Analysis
Problem Statement:
Given a string s
containing only the characters '('
and ')'
, we need to return the length of the longest valid (well-formed) parentheses substring.
For example, for
s = "(()"
, the answer is2
because the longest valid substring is"()"
.For
s = ")()())"
, the answer is4
because the longest valid subst…
Keep reading with a 7-day free trial
Subscribe to ABINASH KUMAR MISHRA to keep reading this post and get 7 days of free access to the full post archives.