#1044
Longest Duplicate Substring
international master · 1960 · lc hard +32 · verified · 31.1% accepted · 2,338 likes · top 9%
Description
Among all substrings of s that appear two or more times (possibly overlapping), return any one with the greatest length. If no such substring exists, return "".
Example 1:
Input: s = "banana"
Output: "ana"
Example 2:
Input: s = "abcd"
Output: ""
Code
1
2
3