Skip to content

Commit 6a3bf5d

Browse files
committed
working commit - Created using LeetHub
1 parent 8e3afa3 commit 6a3bf5d

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<h2>unknown-problem</h2><h3>Easy</h3><hr><div><p><i data-stringify-type="italic">Balanced</i>&nbsp;strings are those who have equal quantity of 'L' and 'R' characters.</p>
2+
3+
<p>Given a balanced string&nbsp;<code data-stringify-type="code">s</code>&nbsp;split it in the maximum amount of balanced strings.</p>
4+
5+
<p>Return the maximum amount of splitted balanced strings.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong>Example 1:</strong></p>
9+
10+
<pre><strong>Input:</strong> s = "RLRRLLRLRL"
11+
<strong>Output:</strong> 4
12+
<strong>Explanation: </strong>s can be split into "RL", "RRLL", "RL", "RL", each substring contains same number of 'L' and 'R'.
13+
</pre>
14+
15+
<p><strong>Example 2:</strong></p>
16+
17+
<pre><strong>Input:</strong> s = "RLLLLRRRLR"
18+
<strong>Output:</strong> 3
19+
<strong>Explanation: </strong>s can be split into "RL", "LLLRRR", "LR", each substring contains same number of 'L' and 'R'.
20+
</pre>
21+
22+
<p><strong>Example 3:</strong></p>
23+
24+
<pre><strong>Input:</strong> s = "LLLLRRRR"
25+
<strong>Output:</strong> 1
26+
<strong>Explanation: </strong>s can be split into "LLLLRRRR".
27+
</pre>
28+
29+
<p><strong>Example 4:</strong></p>
30+
31+
<pre><strong>Input:</strong> s = "RLRRRLLRLL"
32+
<strong>Output:</strong> 2
33+
<strong>Explanation: </strong>s can be split into "RL", "RRRLLRLL", since each substring contains an equal number of 'L' and 'R'
34+
</pre>
35+
36+
<p>&nbsp;</p>
37+
<p><strong>Constraints:</strong></p>
38+
39+
<ul>
40+
<li><code>1 &lt;= s.length &lt;= 1000</code></li>
41+
<li><code>s[i] = 'L' or 'R'</code></li>
42+
</ul>
43+
</div>

0 commit comments

Comments
 (0)