I have implemented this algorithm for the Longest common subsequence, I have tested it for every possible test case, it works, but when I submit it to the online grader of the course, it says it failed on case 11, I can't think of any possible test case that would break it down. Can you help? It returns idx longest subsequence.
def lcs2(a, b):
idx = 0
for i in a:
if i not in b:
a.remove(i)
if len(a) <= len(b):
for i in a:
if i in b:
idx += 1; b = b[b.index(i)+1:]
else:
for i in b:
if i in a:
idx += 1; a = a[a.index(i)+1:]
return idx