What is the best way to find maximum number of consecutive common elements (or length of longest common consecutive sequence?) in two lists of strings in Python?
For example:
List1 = ['sun', 'moon', 'flower', 'fruit', 'apple', 'star', 'rose', 'fruit', 'lily', 'fairy']
fxn(List1, ['hercules', 'flower', 'fruit', 'rose']) Returns 2 (flower, fruit)
fxn(List1, ['flower', 'fruit', 'apple', 'star']) Returns 4
fxn(List1, ['apple', 'rose', 'flower', 'fruit', 'apple']) Returns 3 (flower, fruit, apple)
fxn(List1, ['moon', 'apple', 'fairy']) Returns 1
I hope I have worded the question well. The sample inputs and corresponding expected output might help. I did my best at searching for a duplicate, but haven't found any. Let me know if there is one.