5 lines soln with help


#1
int Solution::numTrees(int A) {
vector<int>t;     //declare array/vector and make t[0]=t[1]=1;
t.push_back(1);
t.push_back(1);

for(int i=2;i<A+1;i++){
    t.push_back(0);
    for(int j=0;j<i;j++)
    t[i]=t[i]+(t[j]*t[i-j-1]);
}
return t[A];
}
//for help please see https://www.youtube.com/watch?v=YDf982Lb84o