Answers for "common child hackerrank solution"

0

common child hackerrank solution

def commonChild(s1, s2):
    m = [[0]*(len(s2)+1) for _ in range(len(s1)+1)]
    for i,c in enumerate(s1,1):
        for j,d in enumerate(s2,1):
            if c == d:
                m[i][j] = m[i-1][j-1]+1
            else:
                m[i][j] = max(m[i][j-1],m[i-1][j])
                   
    return m[-1][-1]
print(commonChild(input(), input()))
Posted by: Guest on May-06-2021

Code answers related to "common child hackerrank solution"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language