0
longest common subsequence
I am trying to find longest common subsequence of two strings. I think I have implemented correct logic but it is giving wrong input for a test case. Can someone tell me what's the problem with this code? s = "abcde" t = "acek" it should give 3 for the above test case https://code.sololearn.com/c9O28zPF55i2
1 Resposta
0
# Hi! This is a way to find common substrings. Maybe it can help you to compare outputs from your code:
l = input().split() or ["abcekde", "acekt", "zaqacekyi"]
print(max([min(l)[i:j] for i in range(len(min(l))) for j in range(i, len(min(l)) + 1) if all([min(l)[i:j] in wd for wd in l])], key=len))