Allocate Minimum Number of Pages
Hard

Problem Statement

Given an array of integers `pages` representing the number of pages in `n` books and a number of students `k`, allocate the books to `k` students such that each student gets at least one book, all books are assigned, and each assignment is a contiguous block of books. The goal is to minimize the maximum number of pages assigned to any single student.

Examples

1Example 1
Input:
{ "pages": [ 12, 34, 67, 90 ], "k": 2 }
Output:
113
2Example 2
Input:
{ "pages": [ 10, 20, 30, 40 ], "k": 2 }
Output:
60
3Example 3
Input:
{ "pages": [ 10, 5, 20 ], "k": 2 }
Output:
20
Loading...

Sign in to Run Code and Submit