java.lang.Object
g1001_1100.s1044_longest_duplicate_substring.Solution

public class Solution extends Object
1044 - Longest Duplicate Substring.<p>Hard</p> <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>&quot;&quot;</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> s = &ldquo;banana&rdquo;</p> <p><strong>Output:</strong> &ldquo;ana&rdquo;</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> s = &ldquo;abcd&rdquo;</p> <p><strong>Output:</strong> &quot;&quot;</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>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • longestDupSubstring

      public String longestDupSubstring(String s)