Problem : Click here My Code :: ....
#include <bits stdc++.h=""> using namespace std; int main() { int t; cin>>t; while(t) { string A,B; cin>>A>>B; char w='q'; long int a=A.size(),b=B.size(); long int c=max(a,b),d=min(a,b),z=0; for(int i=0;i<a;i++) { for(int j=0;j<b;j++) { if(A.at(i)==B.at(j) && A.at(i)!=w && B.at(j)!=w) { z++; A.at(i)=w; B.at(j)=w; } } } cout<<cz<<endl; } return 0; }
........... I am new to Programming ! :/ .. So anyone please explain where i have gone wrong ? Comments in the problem say that this problem requires dp. i donno dp :( (as i am new ) ! if this can't be solved in the way i did and compulsorily requires dp. Suggest me link to learn . Thanks in advance !!. asked 08 Dec '14, 17:41

This is a standard DP problem. take a look at this link http://www.geeksforgeeks.org/dynamicprogrammingset5editdistance/ answered 08 Dec '14, 18:37
