Longest Duplicate Substring
HardLeetCodeString Algorithms (KMP, Z, Hashing)
Approach hintTry it first, then revealHide
If a repeated substring of length L exists, so does one of every shorter length, so binary search on L. Check a length with a rolling hash stored in a hash set, using double hashing or a large modulus against collisions.