How can I check if any suffix of a string is a prefix of an another string, preferably in constant time, if I already built a suffix array of the first string?
Example:
string 1:
abc
string 2:
bcda
bc
is a substring of first string, and a prefix of the second.