1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-12 02:41:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
Files
leetcode-problemset/leetcode-cn/problem (Chinese)/不相交子字符串的最大数量 [find-maximum-number-of-non-intersecting-substrings].html
2025-05-25 15:08:47 +08:00

41 lines
1.3 KiB
HTML
Raw 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>word</code></p>
<p>返回以&nbsp;<strong>首尾字母相同&nbsp;</strong>&nbsp;<strong>长度至少为 4&nbsp;</strong>&nbsp;<strong>不相交子字符串&nbsp;</strong>的最大数量。</p>
<p><strong>子字符串&nbsp;</strong>是字符串中连续的&nbsp;<b>非空&nbsp;</b>字符序列。</p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<div class="example-block">
<p><strong>输入:</strong> <span class="example-io">word = "abcdeafdef"</span></p>
<p><strong>输出:</strong> <span class="example-io">2</span></p>
<p><strong>解释:</strong></p>
<p>两个子字符串是 <code>"abcdea"</code><code>"fdef"</code></p>
</div>
<p><strong class="example">示例 2</strong></p>
<div class="example-block">
<p><strong>输入:</strong> <span class="example-io">word = "bcdaaaab"</span></p>
<p><strong>输出:</strong> <span class="example-io">1</span></p>
<p><strong>解释:</strong></p>
<p>唯一的子字符串是 <code>"aaaa"</code>。注意我们&nbsp;<strong>不能&nbsp;</strong>同时选择 <code>"bcdaaaab"</code>,因为它和另一个子字符串有重叠。</p>
</div>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= word.length &lt;= 2 * 10<sup>5</sup></code></li>
<li><code>word</code> 仅由小写英文字母组成。</li>
</ul>