We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
m = [[0]*(len(s1)+1)]*(len(s1)+1)
for i in range(0,len(s1)):
for j in range(0,len(s1)):
if s1[i] == s2[j]:
m[i+1][j+1] = max(m[i][j],m[i][j])+1
else:
m[i+1][j+1] = max(m[i][j+1],m[i+1][j])
print(m)
return m[len(s1)][len(s1)]
need help with the code, Solved via dynamic programming idk whats wrng
Cookie support is required to access HackerRank
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 →
def commonChild(s1, s2):