← Questions

Longest duplicated substring

0
GoogleCodingLast asked Dec 2025

Return any longest substring that occurs at least twice in a string (the occurrences may overlap), or an empty string if none does. Binary search on the length with a rolling hash, or use a suffix array, and handle hash collisions.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding