mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
		
			844 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			844 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>Given a string <code>s</code>, consider all <em>duplicated substrings</em>: (contiguous) substrings of s that occur 2 or more times. The occurrences may overlap.</p>
 | 
						|
 | 
						|
<p>Return <strong>any</strong> duplicated substring that has the longest possible length. If <code>s</code> does not have a duplicated substring, the answer is <code>""</code>.</p>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
<p><strong class="example">Example 1:</strong></p>
 | 
						|
<pre><strong>Input:</strong> s = "banana"
 | 
						|
<strong>Output:</strong> "ana"
 | 
						|
</pre><p><strong class="example">Example 2:</strong></p>
 | 
						|
<pre><strong>Input:</strong> s = "abcd"
 | 
						|
<strong>Output:</strong> ""
 | 
						|
</pre>
 | 
						|
<p> </p>
 | 
						|
<p><strong>Constraints:</strong></p>
 | 
						|
 | 
						|
<ul>
 | 
						|
	<li><code>2 <= s.length <= 3 * 10<sup>4</sup></code></li>
 | 
						|
	<li><code>s</code> consists of lowercase English letters.</li>
 | 
						|
</ul>
 |