1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-02 14:12:17 +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>s</code> 和一个整数 <code>repeatLimit</code> ,用 <code>s</code> 中的字符构造一个新字符串 <code>repeatLimitedString</code> ,使任何字母 <strong>连续</strong> 出现的次数都不超过 <code>repeatLimit</code> 次。你不必使用 <code>s</code> 中的全部字符。</p>\n\n<p>返回 <strong>字典序最大的</strong><em> </em><code>repeatLimitedString</code> 。</p>\n\n<p>如果在字符串 <code>a</code> 和 <code>b</code> 不同的第一个位置,字符串 <code>a</code> 中的字母在字母表中出现时间比字符串 <code>b</code> 对应的字母晚,则认为字符串 <code>a</code> 比字符串 <code>b</code> <strong>字典序更大</strong> 。如果字符串中前 <code>min(a.length, b.length)</code> 个字符都相同,那么较长的字符串字典序更大。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><strong>输入:</strong>s = \"cczazcc\", repeatLimit = 3\n<strong>输出:</strong>\"zzcccac\"\n<strong>解释:</strong>使用 s 中的所有字符来构造 repeatLimitedString \"zzcccac\"。\n字母 'a' 连续出现至多 1 次。\n字母 'c' 连续出现至多 3 次。\n字母 'z' 连续出现至多 2 次。\n因此没有字母连续出现超过 repeatLimit 次,字符串是一个有效的 repeatLimitedString 。\n该字符串是字典序最大的 repeatLimitedString ,所以返回 \"zzcccac\" 。\n注意尽管 \"zzcccca\" 字典序更大,但字母 'c' 连续出现超过 3 次,所以它不是一个有效的 repeatLimitedString 。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><strong>输入:</strong>s = \"aababab\", repeatLimit = 2\n<strong>输出:</strong>\"bbabaa\"\n<strong>解释:</strong>\n使用 s 中的一些字符来构造 repeatLimitedString \"bbabaa\"。 \n字母 'a' 连续出现至多 2 次。 \n字母 'b' 连续出现至多 2 次。 \n因此没有字母连续出现超过 repeatLimit 次,字符串是一个有效的 repeatLimitedString 。 \n该字符串是字典序最大的 repeatLimitedString ,所以返回 \"bbabaa\" 。 \n注意尽管 \"bbabaaa\" 字典序更大,但字母 'a' 连续出现超过 2 次,所以它不是一个有效的 repeatLimitedString 。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= repeatLimit &lt;= s.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>s</code> 由小写英文字母组成</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 16,
"likes": 20,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"5.6K\", \"totalSubmission\": \"11.8K\", \"totalAcceptedRaw\": 5589, \"totalSubmissionRaw\": 11831, \"acRate\": \"47.2%\"}",
"stats": "{\"totalAccepted\": \"5.8K\", \"totalSubmission\": \"12.2K\", \"totalAcceptedRaw\": 5806, \"totalSubmissionRaw\": 12160, \"acRate\": \"47.7%\"}",
"hints": [
"Start constructing the string in descending order of characters.",
"When repeatLimit is reached, pick the next largest character."