Whats wrong here?


#1

vector<vector > Solution::solve(int A) {
vector<vector> res (A);
for(int i=0;i<A;++i){
if(i==0){
res[i]=vector(1);
res[i][i]=1;
continue;
}
if(i==1){
res[1]=vector(2);
res[i][0]=1;
res[i][1]=1;
cout<<“here”;
continue;
}
if(i>1){
cout<<“in”;
res[i]=vector(i+1);
res[i][0]=1;
for(int j=1;j<=i-1;i++){
res[i][j]=res[i-1][j]+res[i-1][j-1];
}
res[i][i]=1;
}
}
return res;

}


#2

hey brother i think your code contains few bugs.
first you haven’t specified vector type in the declaration part correct syntax would be
“vector< vector > res (A)” also the values you are assigning doesn’t look right to me.
it would be better if you could go through this blog and read about how to operate on vectors first.