Easy and simple solution in c++


#1

vector Solution::getRow(int A) {
vector<vector>p;
vectorans;
for(int i=0;i<=A;i++){
vectortemp;
for(int j=0;j<=i;j++){
if(i==0||j==0||j==i)
temp.push_back(1);
else
temp.push_back(p[i-1][j]+p[i-1][j-1]);

    }
    p.push_back(temp);
}
for(int i=0;i<=A;i++){
    ans.push_back(p[A][i]);
}
return ans ;

}