We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f1158e0 commit ad1458cCopy full SHA for ad1458c
1 file changed
Lowest_common_subsequence
@@ -0,0 +1,13 @@
1
+def lcs(X,Y):
2
+ T= [[0 for i in range(10)]for j in range(10)]
3
+ for i in range(len(X)):
4
+ for j in range(len(Y)):
5
+ if(X[i]==Y[j]):
6
+ T[i][j]= 1+ T[i-1][j-1]
7
+ else:
8
+ T[i][j]= max(T[i-1][j],T[i][j-1])
9
+ return T[i][j]
10
+
11
+X="eg"
12
+Y="defg"
13
+print(lcs(X,Y))
0 commit comments