Painters problem

Hi @vikashkmr519,
There are a lot of errors conceptual as well as typos. I have added comment to your code check them. Other than that i am writing here too.

  1. Make data type as long as sum can be a large number.
  2. Array must not be sorted .
  3. Check must be there while give ans a new number as ans must be min . And to start ans must be Integer.MAX_VALUE or sum.
    check this code
    https://ide.codingblocks.com/s/133035

i have understood the concept but their is still on doubt , it is mentioned in the code, but still i m mentioning it here also. i have a doubt on the concept of the isvalid , plss explain me in detail what is happening in the background of the isvalid concept

In isvalid it is checking whether the number of painters required are less than or equal to the number of painter available for a provided max size of board that painter can paint… if No painter paints more than the max size and the required number of painter are less than number of painter available then the max is valid … otherwise the max must be increased …

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.