dsa6 min read
Longest Duplicate Substring — Binary Search and Rabin-Karp Rolling Hash
Find the longest substring that appears at least twice using binary search on the answer length combined with a Rabin-Karp rolling hash. A FAANG-level Hard problem solved in O(n log n) average time with full pseudocode in Python and JavaScript.
Read →