Just a simple precise code


#1

The solution given in hints seems to be complex and unclean, so here is my simple solution :

vector<int> Solution::getRow(int A) {

vector<int> prev;

for(int i=0;i<=A;i++){
    vector<int>temp;
    for(int j=0;j<i;j++){
        if(j<1)temp.push_back(1);
        else temp.push_back(prev[j]+prev[j-1]);
    }
    temp.push_back(1);
    prev=temp;
    
}

return prev;

}