mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-14 03:41:41 +08:00
add leetcode problem-cn part6
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<p>给你一个只包含 <code>'('</code> 和 <code>')'</code> 的字符串,找出最长有效(格式正确且连续)括号子串的长度。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<div class="original__bRMd">
|
||||
<div>
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "(()"
|
||||
<strong>输出:</strong>2
|
||||
<strong>解释:</strong>最长有效括号子串是 "()"
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = ")()())"
|
||||
<strong>输出:</strong>4
|
||||
<strong>解释:</strong>最长有效括号子串是 "()()"
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = ""
|
||||
<strong>输出:</strong>0
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>0 <= s.length <= 3 * 10<sup>4</sup></code></li>
|
||||
<li><code>s[i]</code> 为 <code>'('</code> 或 <code>')'</code></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user