blob: 9e701694c67223599103da71f5842db1da30d46d (
plain)
1
2
3
4
5
6
7
8
|
def super_seq(X, Y, m, n):
if (not m):
return n
if (not n):
return m
if (X[m - 1] == Y[n - 1]):
return 1 + super_seq(X, Y, m - 1, n - 1)
return 1 + min(super_seq(X, Y, m - 1, n), super_seq(X, Y, m, n - 1))
|