Why am I getting segmentation fault in this code?


#1
vector<int> Solution::getRow(int A) {
vector<int>row(A+1);
//cout<<row.size()<<endl;
for(int i=0;i<=A;i++) {
    if(i==0 || i==A) {
        row[i]=1;
    }
    else {
        row[i] = row[i-1]*(A-i+1)/i;
    }
    //cout<<i<<endl;
}
}