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)/最长重复子串 [longest-duplicate-substring].html
2022-03-29 12:43:11 +08:00

29 lines
825 B
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>s</code> ,考虑其所有 <em>重复子串</em> :即&nbsp;<code>s</code> 的(连续)子串,在 <code>s</code> 中出现 2 次或更多次。这些出现之间可能存在重叠。</p>
<p>返回 <strong>任意一个</strong> 可能具有最长长度的重复子串。如果 <code>s</code> 不含重复子串,那么答案为 <code>""</code></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>s = "banana"
<strong>输出:</strong>"ana"
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>s = "abcd"
<strong>输出:</strong>""
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>2 &lt;= s.length &lt;= 3 * 10<sup>4</sup></code></li>
<li><code>s</code> 由小写英文字母组成</li>
</ul>