Book Allocation Problem (Allocate minimum number of pages)
Given an array of integers A of size N and an integer B. College library has N bags, the ith book has A[i] number of pages.
You have to allocate books to B number of students so that the maximum number of pages allocated to a student is minimum. A book will be allocated to exactly one student. Each student has to be allocated at least one book. Allotment should be in contiguous order, for example, A student cannot be allocated book 1 and book 3, skipping book 2. Calculate and return that minimum possible number. Return -1 if a valid assignment is not possible.
The first line contains T denoting the number of test cases. Then follows a description of T test cases: Each case begins with a single positive integer N denoting the number of books. The second line contains N space-separated positive integers denoting the pages of each book. And the third line contains another integer B, denoting the number of students.
For each test case, output a single line containing the minimum number of pages each student has to read for the corresponding test case.
60, one student assigned 60 pages and other 40.
[12 34 67 90]
113, one student assigned 113 pages and other 90.