1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-22 13:36:46 +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>在一个 <strong>平衡字符串</strong> 中,<code>'L'</code> 和 <code>'R'</code> 字符的数量是相同的。</p>\n\n<p>给你一个平衡字符串&nbsp;<code>s</code>,请你将它分割成尽可能多的平衡字符串。</p>\n\n<p><strong>注意:</strong>分割得到的每个字符串都必须是平衡字符串,且分割得到的平衡字符串是原平衡字符串的连续子串。</p>\n\n<p>返回可以通过分割得到的平衡字符串的 <strong>最大数量</strong> <strong>。</strong></p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"RLRRLLRLRL\"\n<strong>输出:</strong>4\n<strong>解释:</strong>s 可以分割为 \"RL\"、\"RRLL\"、\"RL\"、\"RL\" ,每个子字符串中都包含相同数量的 'L' 和 'R' 。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"RLLLLRRRLR\"\n<strong>输出:</strong>3\n<strong>解释:</strong>s 可以分割为 \"RL\"、\"LLLRRR\"、\"LR\" ,每个子字符串中都包含相同数量的 'L' 和 'R' 。\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"LLLLRRRR\"\n<strong>输出:</strong>1\n<strong>解释:</strong>s 只能保持原样 \"LLLLRRRR\".\n</pre>\n\n<p><strong>示例 4</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"RLRRRLLRLL\"\n<strong>输出:</strong>2\n<strong>解释:</strong>s 可以分割为 \"RL\"、\"RRRLLRLL\" ,每个子字符串中都包含相同数量的 'L' 和 'R' 。\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;= 1000</code></li>\n\t<li><code>s[i] = 'L' 或 'R'</code></li>\n\t<li><code>s</code> 是一个 <strong>平衡</strong> 字符串</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 181,
"likes": 183,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"81.4K\", \"totalSubmission\": \"96.5K\", \"totalAcceptedRaw\": 81433, \"totalSubmissionRaw\": 96483, \"acRate\": \"84.4%\"}",
"stats": "{\"totalAccepted\": \"82.3K\", \"totalSubmission\": \"97.4K\", \"totalAcceptedRaw\": 82255, \"totalSubmissionRaw\": 97429, \"acRate\": \"84.4%\"}",
"hints": [
"Loop from left to right maintaining a balance variable when it gets an L increase it by one otherwise decrease it by one.",
"Whenever the balance variable reaches zero then we increase the answer by one."