A book has chapters with page counts pages (in order). You have m editors. Each editor receives one contiguous block of chapters (possibly empty), and every chapter goes to exactly one editor. The time needed is the largest number of pages any single editor gets. Return the smallest possible value of that maximum.
Examples
Input: pages = [4, 9, 3, 6, 5, 2], m = 3
Output: 13
Explanation: [4, 9] | [3, 6] | [5, 2] gives loads 13, 9, 7. No split keeps every load at 12.
Input: pages = [10, 1, 1, 1], m = 2
Output: 10
Constraints
1 <= len(pages) <= 5 * 10**4,1 <= pages[i] <= 1000,1 <= m <= 10**4.- Target complexity: O(n log(sum(pages))).
Goals
- Check a candidate maximum load with a single greedy pass
- Binary search the smallest feasible load between max(pages) and sum(pages)
- Explain why feasibility is monotone in the load