mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 11:21:42 +08:00
add leetcode problem-cn part1
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<p>给你一个由 <code>'('</code>、<code>')'</code> 和小写字母组成的字符串 <code>s</code>。</p>
|
||||
|
||||
<p>你需要从字符串中删除最少数目的 <code>'('</code> 或者 <code>')'</code> (可以删除任意位置的括号),使得剩下的「括号字符串」有效。</p>
|
||||
|
||||
<p>请返回任意一个合法字符串。</p>
|
||||
|
||||
<p>有效「括号字符串」应当符合以下 <strong>任意一条 </strong>要求:</p>
|
||||
|
||||
<ul>
|
||||
<li>空字符串或只包含小写字母的字符串</li>
|
||||
<li>可以被写作 <code>AB</code>(<code>A</code> 连接 <code>B</code>)的字符串,其中 <code>A</code> 和 <code>B</code> 都是有效「括号字符串」</li>
|
||||
<li>可以被写作 <code>(A)</code> 的字符串,其中 <code>A</code> 是一个有效的「括号字符串」</li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "lee(t(c)o)de)"
|
||||
<strong>输出:</strong>"lee(t(c)o)de"
|
||||
<strong>解释:</strong>"lee(t(co)de)" , "lee(t(c)ode)" 也是一个可行答案。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "a)b(c)d"
|
||||
<strong>输出:</strong>"ab(c)d"
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "))(("
|
||||
<strong>输出:</strong>""
|
||||
<strong>解释:</strong>空字符串也是有效的
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= s.length <= 10<sup>5</sup></code></li>
|
||||
<li><code>s[i]</code> 可能是 <code>'('</code>、<code>')'</code> 或英文小写字母</li>
|
||||
</ul>
|
Reference in New Issue
Block a user