Skip to content

rabin karp

Longest repeated substring problem is a problem of finding the longest substring that occurs at least twice in a given string. This is also one of the important interview questions. Problem Statement Given a string S, consider all duplicated substrings: (contiguous) substrings of S that occur more than once.  (The occurrences may overlap.) Return any duplicated substring that has the longest possible length.  (If S does not have a duplicated substring, the answer is "".) Example 1: Input: “banana”, Output: “ana” Example… Read More »Longest Repeated Substring Problem

Longest Repeated Substring Problem