mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 06:51:41 +08:00
存量题库数据更新
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
<p>在一个 <strong>平衡字符串</strong> 中,<code>'L'</code> 和 <code>'R'</code> 字符的数量是相同的。</p>
|
||||
<p><strong>平衡字符串</strong> 中,<code>'L'</code> 和 <code>'R'</code> 字符的数量是相同的。</p>
|
||||
|
||||
<p>给你一个平衡字符串 <code>s</code>,请你将它分割成尽可能多的平衡字符串。</p>
|
||||
<p>给你一个平衡字符串 <code>s</code>,请你将它分割成尽可能多的子字符串,并满足:</p>
|
||||
|
||||
<p><strong>注意:</strong>分割得到的每个字符串都必须是平衡字符串,且分割得到的平衡字符串是原平衡字符串的连续子串。</p>
|
||||
<ul>
|
||||
<li>每个子字符串都是平衡字符串。</li>
|
||||
</ul>
|
||||
|
||||
<p>返回可以通过分割得到的平衡字符串的 <strong>最大数量</strong> <strong>。</strong></p>
|
||||
|
||||
@@ -19,25 +21,17 @@
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "RLLLLRRRLR"
|
||||
<strong>输出:</strong>3
|
||||
<strong>解释:</strong>s 可以分割为 "RL"、"LLLRRR"、"LR" ,每个子字符串中都包含相同数量的 'L' 和 'R' 。
|
||||
</pre>
|
||||
<strong>输入:</strong>s = "RLRRRLLRLL"
|
||||
<strong>输出:</strong>2
|
||||
<strong>解释:</strong>s 可以分割为 "RL"、"RRRLLRLL",每个子字符串中都包含相同数量的 'L' 和 'R' 。
|
||||
注意,s 无法分割为 "RL"、"RR"、"RL"、"LR"、"LL" 因为第 2 个和第 5 个子字符串不是平衡字符串。</pre>
|
||||
|
||||
<p><strong>示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "LLLLRRRR"
|
||||
<strong>输出:</strong>1
|
||||
<strong>解释:</strong>s 只能保持原样 "LLLLRRRR".
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 4:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "RLRRRLLRLL"
|
||||
<strong>输出:</strong>2
|
||||
<strong>解释:</strong>s 可以分割为 "RL"、"RRRLLRLL" ,每个子字符串中都包含相同数量的 'L' 和 'R' 。
|
||||
<strong>解释:</strong>s 只能保持原样 "LLLLRRRR" 。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
@@ -45,7 +39,7 @@
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= s.length <= 1000</code></li>
|
||||
<li><code>2 <= s.length <= 1000</code></li>
|
||||
<li><code>s[i] = 'L' 或 'R'</code></li>
|
||||
<li><code>s</code> 是一个 <strong>平衡</strong> 字符串</li>
|
||||
</ul>
|
||||
|
Reference in New Issue
Block a user