what is the problem
this is my recursive logic
int NoPairs (int n)
{
if(n<=2)
return n;
return NoPairs(n-1) + (n-1)*NoPairs(n-2);
}
what is the problem
this is my recursive logic
int NoPairs (int n)
{
if(n<=2)
return n;
return NoPairs(n-1) + (n-1)*NoPairs(n-2);
}
Use more base condition. Recursive line is correct;
Please have a look here