Need help with painter's partition

#include
#include
#include<stdlib.h>
#include
#include
using namespace std;

bool isPossible(int boards [],int k,int n,int mid)
{
int painters=1;
int j=0;

while(j<n)
{

int time=0;
while(time<=mid)
{
time+=boards[j++];

}
j–;
painters++;

}

if(painters<=k)
return true;
else
false;

}

int min_Time(int boards[],int k,int n)
{
int s=*(max_element(boards,boards+n));
int e=0,ans;
for(int i=0;i<n;i++)
{

  e=e+boards[i];

}

while(s<=e)
{
int mid=(s+e)/2;

  if(isPossible(boards,k,n,mid))
  {
      ans=min(ans,mid);
      e=mid-1;
  }
  else
  {
      s=mid+1;
  }

}
return ans;
}

int main()
{
int k,n;

cin>>k;
cin>>n;

int *boards = new int[n];

for(int i=0;i<n;i++)
{
cin>>boards[i];

}

cout<<min_Time(boards,k,n)<<endl;

delete [] boards;
}

some minor issues lies in isPossible() method. I fixed them . please have a look.

updated code: https://ide.codingblocks.com/s/212038

thanks
please rate and resolve if satisfied.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.