Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Book Allocation for Java #367

Open
Nikhilsl12 opened this issue Oct 24, 2024 · 1 comment
Open

Book Allocation for Java #367

Nikhilsl12 opened this issue Oct 24, 2024 · 1 comment
Assignees

Comments

@Nikhilsl12
Copy link
Contributor

You have n books, each with arr[i] a number of pages. m students need to be allocated contiguous books, with each student getting at least one book.
Out of all the permutations, the goal is to find the permutation where the sum of the maximum number of pages in a book allotted to a student should be the minimum, out of all possible permutations.

Note: Return -1 if a valid assignment is not possible, and allotment should be in contiguous order (see the explanation for better understanding).

Examples:

Input: n = 4, arr[] = [12, 34, 67, 90], m = 2
Output: 113
Explanation: Allocation can be done in following ways:
{12} and {34, 67, 90} Maximum Pages = 191
{12, 34} and {67, 90} Maximum Pages = 157
{12, 34, 67} and {90} Maximum Pages =113.
Therefore, the minimum of these cases is 113, which is selected as the output.
Can you add hacktoberfest label for that.

@DhanushNehru
Copy link
Owner

Hi @Nikhilsl12 this is just a template repo to fork and raise a PR

Checkout repos here to contribute that counts towards hacktoberfest and join discord for more discussions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants