1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-24 22:38:57 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个由 <code>'('</code>、<code>')'</code> 和小写字母组成的字符串 <code>s</code>。</p>\n\n<p>你需要从字符串中删除最少数目的 <code>'('</code> 或者 <code>')'</code>&nbsp;(可以删除任意位置的括号),使得剩下的「括号字符串」有效。</p>\n\n<p>请返回任意一个合法字符串。</p>\n\n<p>有效「括号字符串」应当符合以下&nbsp;<strong>任意一条&nbsp;</strong>要求:</p>\n\n<ul>\n\t<li>空字符串或只包含小写字母的字符串</li>\n\t<li>可以被写作&nbsp;<code>AB</code><code>A</code>&nbsp;连接&nbsp;<code>B</code>)的字符串,其中&nbsp;<code>A</code>&nbsp;和&nbsp;<code>B</code>&nbsp;都是有效「括号字符串」</li>\n\t<li>可以被写作&nbsp;<code>(A)</code>&nbsp;的字符串,其中&nbsp;<code>A</code>&nbsp;是一个有效的「括号字符串」</li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"lee(t(c)o)de)\"\n<strong>输出:</strong>\"lee(t(c)o)de\"\n<strong>解释:</strong>\"lee(t(co)de)\" , \"lee(t(c)ode)\" 也是一个可行答案。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"a)b(c)d\"\n<strong>输出:</strong>\"ab(c)d\"\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"))((\"\n<strong>输出:</strong>\"\"\n<strong>解释:</strong>空字符串也是有效的\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>s[i]</code>&nbsp;可能是&nbsp;<code>'('</code>、<code>')'</code>&nbsp;或英文小写字母</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 175,
"likes": 178,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"30.1K\", \"totalSubmission\": \"51.5K\", \"totalAcceptedRaw\": 30089, \"totalSubmissionRaw\": 51501, \"acRate\": \"58.4%\"}",
"stats": "{\"totalAccepted\": \"31.3K\", \"totalSubmission\": \"53.5K\", \"totalAcceptedRaw\": 31292, \"totalSubmissionRaw\": 53507, \"acRate\": \"58.5%\"}",
"hints": [
"Each prefix of a balanced parentheses has a number of open parentheses greater or equal than closed parentheses, similar idea with each suffix.",
"Check the array from left to right, remove characters that do not meet the property mentioned above, same idea in backward way."