I have problem with this question, I think the logic is incorrect, could someone please explain the logic a little more to me?

the code: https://ide.codingblocks.com/s/464219

/// Painter Partition Problem

here i am explaining the Problem and its solution

Problem:
You have to find the min time require to paint all boards

Solution
min time to paint the board = time taken by that painter who is painting max no of boards

boards[] = {12, 34, 67, 90}
No of painters = 2

There are 2 number of paiters. boards can be distributed in following fashion :

  1. [12] and [34, 67, 90]
    Max number of boards is allocated to painter
    2 with 34 + 67 + 90 = 191 boards
    we can say that the time require by 2nd painter is the total time
    because in the same time painter 1 can finished his task
  2. [12, 34] and [67, 90]
    Max number of boards is allocated to painter
    2 with 67 + 90 = 157 boards
  3. [12, 34, 67] and [90]
    Max number of boards is allocated to painter
    1 with 12 + 34 + 67 = 113 boards

from the above distribution we can say that min time is taken in 3rd case

so first we have to minimize the max no of boards assigned to 1 painter
after that if we get the max no of board painted by 1 painter(lets say painter px will paint these boards)
then time requried to paint these board will be the total time
because when px paint these boards meanwhile (on the same time) other painters also paint the boards assingn to them

and to find the max no of boards assigned to painter(minimized) we can use binary search

look at reference Code
Reference Code

in this code you have to take time=1;

if you want to ask something about this feel free to ask
i hope this helps
if yes show your response with :heart: and don’t forgot to mark doubt as resolved