Can any body plz see, whats wrong in this code


#1

using namespace std;

string a, b;
vector<vector> sl;

int lcs(int as, int bs){
if(as==-1||bs==-1)
return 0;
if(sl[as][bs] != -1){
return sl[as][bs];
}
if(a[as]==b[bs]){
sl[as][bs]=1+lcs(as-1,bs-1);
}else{
sl[as][bs]=max(lcs(as,bs-1), lcs(as-1,bs));
}
return sl[as][bs];
}

int Solution::solve(string A, string B) {
a=A;
b=B;
int as = A.size(), bs = B.size();

vector<int> tmp; 
for(int j=0; j<bs; j++){
    tmp.push_back(-1);
}
for(int j=0; j<as; j++){
    sl.push_back(tmp);
}

int res= lcs(as-1, bs-1);
return res;

}