1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-13 19:31:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

add leetcode problem-cn part1

This commit is contained in:
2022-03-27 20:37:52 +08:00
parent 8e542045d1
commit c554fc6908
1285 changed files with 108123 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<p>如果字符串中的所有字符都相同,那么这个字符串是单字符重复的字符串。</p>
<p>给你一个字符串&nbsp;<code>text</code>,你只能交换其中两个字符一次或者什么都不做,然后得到一些单字符重复的子串。返回其中最长的子串的长度。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>text = &quot;ababa&quot;
<strong>输出:</strong>3
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>text = &quot;aaabaaa&quot;
<strong>输出:</strong>6
</pre>
<p><strong>示例 3</strong></p>
<pre><strong>输入:</strong>text = &quot;aaabbaaa&quot;
<strong>输出:</strong>4
</pre>
<p><strong>示例 4</strong></p>
<pre><strong>输入:</strong>text = &quot;aaaaa&quot;
<strong>输出:</strong>5
</pre>
<p><strong>示例 5</strong></p>
<pre><strong>输入:</strong>text = &quot;abcdef&quot;
<strong>输出:</strong>1
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= text.length &lt;= 20000</code></li>
<li><code>text</code> 仅由小写英文字母组成。</li>
</ul>