mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 07:21:40 +08:00
update
This commit is contained in:
33
leetcode/problem/longest-valid-parentheses.html
Normal file
33
leetcode/problem/longest-valid-parentheses.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<p>Given a string containing just the characters <code>'('</code> and <code>')'</code>, find the length of the longest valid (well-formed) parentheses substring.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "(()"
|
||||
<strong>Output:</strong> 2
|
||||
<strong>Explanation:</strong> The longest valid parentheses substring is "()".
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = ")()())"
|
||||
<strong>Output:</strong> 4
|
||||
<strong>Explanation:</strong> The longest valid parentheses substring is "()()".
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = ""
|
||||
<strong>Output:</strong> 0
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>0 <= s.length <= 3 * 10<sup>4</sup></code></li>
|
||||
<li><code>s[i]</code> is <code>'('</code>, or <code>')'</code>.</li>
|
||||
</ul>
|
Reference in New Issue
Block a user