1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-02 22:13:28 +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>给你一个字符串&nbsp;<code>s</code>,「<code>k</code> 倍重复项删除操作」将会从 <code>s</code>&nbsp;中选择&nbsp;<code>k</code>&nbsp;个相邻且相等的字母,并删除它们,使被删去的字符串的左侧和右侧连在一起。</p>\n\n<p>你需要对&nbsp;<code>s</code>&nbsp;重复进行无限次这样的删除操作,直到无法继续为止。</p>\n\n<p>在执行完所有删除操作后,返回最终得到的字符串。</p>\n\n<p>本题答案保证唯一。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><strong>输入:</strong>s = &quot;abcd&quot;, k = 2\n<strong>输出:</strong>&quot;abcd&quot;\n<strong>解释:</strong>没有要删除的内容。</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><strong>输入:</strong>s = &quot;deeedbbcccbdaa&quot;, k = 3\n<strong>输出:</strong>&quot;aa&quot;\n<strong>解释: \n</strong>先删除 &quot;eee&quot; 和 &quot;ccc&quot;,得到 &quot;ddbbbdaa&quot;\n再删除 &quot;bbb&quot;,得到 &quot;dddaa&quot;\n最后删除 &quot;ddd&quot;,得到 &quot;aa&quot;</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre><strong>输入:</strong>s = &quot;pbbcggttciiippooaais&quot;, k = 2\n<strong>输出:</strong>&quot;ps&quot;\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^5</code></li>\n\t<li><code>2 &lt;= k &lt;= 10^4</code></li>\n\t<li><code>s</code>&nbsp;中只含有小写英文字母。</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 129,
"likes": 133,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"14.2K\", \"totalSubmission\": \"27.4K\", \"totalAcceptedRaw\": 14170, \"totalSubmissionRaw\": 27398, \"acRate\": \"51.7%\"}",
"stats": "{\"totalAccepted\": \"14.5K\", \"totalSubmission\": \"28.2K\", \"totalAcceptedRaw\": 14528, \"totalSubmissionRaw\": 28191, \"acRate\": \"51.5%\"}",
"hints": [
"Use a stack to store the characters, when there are k same characters, delete them.",
"To make it more efficient, use a pair to store the value and the count of each character."