" Your code might be failing for larger test-cases"

google
Tags: #<Tag:0x00007f1828298758>

#1

I am getting an the above mentioned error and they are saying that the solution is wrong.

int factorial(int n)
{

int res = 1; 
for (int i = 2; i <= n; i++) 
    res = res * i; 
return res; 

}

int choose(int n, int r){

return (factorial(n)/(factorial(n-r)*factorial(r)));

}

vector Solution::getRow(int A) {
/* 1
11
121
1331
14641
*/
vectorarray(A+1);
if(A == 0){
array[0] = 1;
return array;
}
else{
for(int i=0; i<A+1;i++){
array[i] = choose(A, i);
}

}
return array;

}


#2

try dividing larger digits first that way overflow doesnt happen