Painter's Partition Problem

Given an array boards of board lengths and the number of painters painters, each painter paints one contiguous block of boards, every board is painted by…

Given an array `boards` of board lengths and the number of painters `painters`, each painter paints one contiguous block of boards, every board is painted by exactly one painter, and painting one unit of length takes one unit of time. All painters work at the same time. Return the minimum possible time to paint every board, which is the smallest achievable value of the largest total length any single painter is given.

- `1 <= boards.length <= 20` - `1 <= boards[i] <= 100` - `1 <= painters <= boards.length`

Example 1: input boards = [10,20,30,40], painters = 2; output 60. Assignments [10,20,30] and [40] finish in 60 time units.

Example 2: input boards = [5,5,5,5], painters = 2; output 10. Each painter receives two adjacent boards.

Category: Binary Search. Topic: binary-search. Difficulty: Hard. Patterns: binary-search-on-answer, greedy.