1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/每个字符最多出现两次的最长子字符串 [maximum-length-substring-with-two-occurrences].html
2024-03-28 09:27:27 +08:00

38 lines
1.3 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个字符串 <code>s</code> ,请找出满足每个字符最多出现两次的最长子字符串,并返回该<span data-keyword="substring">子字符串</span><strong> 最大 </strong>长度。</p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<div class="example-block">
<p><strong>输入:</strong> <span class="example-io">s = "bcbbbcba"</span></p>
<p><strong>输出:</strong> <span class="example-io">4</span></p>
<p><strong>解释:</strong></p>
<p>以下子字符串长度为 4并且每个字符最多出现两次<code>"bcbb<u>bcba</u>"</code></p>
</div>
<p><strong class="example">示例 2</strong></p>
<div class="example-block">
<p><strong>输入:</strong> <span class="example-io">s = "aaaa"</span></p>
<p><strong>输出:</strong> <span class="example-io">2</span></p>
<p><strong>解释:</strong></p>
<p>以下子字符串长度为 2并且每个字符最多出现两次<code>"<u>aa</u>aa"</code></p>
</div>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul><!-- 字符串 s 的长度在 2 到 100 之间 -->
<li><code>2 &lt;= s.length &lt;= 100</code></li>
<!-- 字符串 s 仅包含小写英文字母 -->
<li><code>s</code> 仅由小写英文字母组成。</li>
</ul>