Practice Fair Distribution of Cookies
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Fair Distribution of Cookies
Problem Statement
You are given an integer array cookies, where cookies[i] denotes the number of cookies in the ith bag. You are also given an integer k that denotes the number of children to distribute all the bags of cookies to. All the cookies in the same bag must go to the same child and cannot be split up. The unfairness of a distribution is defined as the maximum total cookies obtained by a single child in the distribution. Return the minimum unfairness of all distributions.
Source: Fair Distribution of Cookies on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
cookies = [8,15,10,20,8], k = 2
31
# Example 2
cookies = [6,1,3,2,2,4,1,2], k = 3
7
Constraints
Related LeetCode Problems
Practice more problems similar to Fair Distribution of Cookies.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.