You are viewing a single comment's thread. Return to all comments →
def commonChild(s1, s2): n=len(s1) g=len(s2) m=[] for i in range(n+1): m.append([]) for _ in range(g+1): m[i].append(0) for i in range(n): for j in range(g): if s1[i]==s2[j]: m[i+1][j+1]=max(m[i][j]+1,m[i+1][j-1]) continue m[i+1][j+1]=max(m[i+1][j],m[i][j+1]) return m[-1][-1]
Seems like cookies are disabled on this browser, please enable them to open this website
Common Child
You are viewing a single comment's thread. Return to all comments →