this is my code for the above problem.
My code is not working properly for the above problem
@priya_Jain
There are few mistakes in your code
- Start should be equal to 1.
- your make function should be like this
bool make(int c,int p,int r[],int mid)
{
int cnt=0,lst=r[0],j=2;
for(int i=1;i<=p;i++)
{
if(cnt==c)
{
return false;
}
if(lst+(j*r[cnt])>mid)
{
cnt++;
j=2;
lst=r[cnt];
}
else{
lst=lst+(j*r[cnt]);
j++;
}
}
return true;
}
what is it and gt in the function and why it is used with &