diff --git a/print longest common subsequence.cpp b/print longest common subsequence.cpp new file mode 100644 index 0000000..70c7293 --- /dev/null +++ b/print longest common subsequence.cpp @@ -0,0 +1,68 @@ +#include +#define ll long long int +#define deb(x) cout << #x << " = " << x << endl +#define deb2(x, y) cout << #x << " = " << x << "," << #y << " = " << y << endl +#define endl '\n' +using namespace std; + +void lcs(string s1,string s2,int n,int m) +{ + int dp[n+1][m+1],i,j; + for(i=0;i>x>>y; + cin>>s1>>s2; + lcs(s1,s2,x,y); +} + +int main() +{ + //ios_base::sync_with_stdio(false);cin.tie(NULL); + int t; cin>>t; while(t--) + { + entente(); + } + return 0; +} diff --git a/print shortest common supersequence.cpp b/print shortest common supersequence.cpp new file mode 100644 index 0000000..4078843 --- /dev/null +++ b/print shortest common supersequence.cpp @@ -0,0 +1,85 @@ +#include +#define ll long long int +#define deb(x) cout << #x << " = " << x << endl +#define deb2(x, y) cout << #x << " = " << x << "," << #y << " = " << y << endl +#define endl '\n' +using namespace std; + +void lcs(string s1,string s2,int n,int m) +{ + int dp[n+1][m+1],i,j; + for(i=0;i0) + { + str.push_back(s1[i-1]); + i--; + } + while (j>0) + { + str.push_back(s2[j-1]); + j--; + } + + reverse(str.begin(),str.end()); + cout<>x>>y; + cin>>s1>>s2; + lcs(s1,s2,x,y); +} + +int main() +{ + //ios_base::sync_with_stdio(false);cin.tie(NULL); + int t; cin>>t; while(t--) + { + entente(); + } + return 0; +} \ No newline at end of file