How to find the longest common substring from more than two strings? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to find the longest common substring from more than two strings?

I can use DP when I have 2 strings but what should I do in this case.

13th Feb 2020, 5:28 PM
Peter Parker
Peter Parker - avatar
2 Answers
+ 9
You can put all the strings you want to examine in a list and then use difflib module with SequenceMatcher.
13th Feb 2020, 5:35 PM
Lothar
Lothar - avatar
+ 2
Thanks Lothar I solved the longest common substring problem.
24th Apr 2020, 12:40 PM
Peter Parker
Peter Parker - avatar