My code is not working properly for the above problem


this is my code for the above problem.

@priya_Jain
There are few mistakes in your code

  1. Start should be equal to 1.
  2. 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 &