dsa · medium
Painter's Partition
boards[i] is the time to paint board i (one unit per time). k painters work in parallel, each taking a **contiguous** segment. Return the minimum time to paint all boards.
Arguments
boards— board lengths / paint timesk— how many painters work in parallel (each paints one contiguous segment)
**Example:** boards=[10,20,30,40], k=2 → 60.
Example
`` Input: [10,20,30,40] 2 Output: 60 ``
Constraints
1 <= k <= len(boards) <= 1000 Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.
Examples
Example 1
Input: [10,20,30,40] 2 Expected: 60