← Questions
Merge two strings on their longest overlap
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Given two strings, join them so that the longest overlap between the end of one and the start of the other appears only once. Try both orders (first then second, and second then first), and keep the order with the longer overlap; on a tie, put the first string first. Return the merged string. Start with the direct approach, then make finding the overlap efficient (a prefix function or hashing).
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
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
