Tap here to switch tabs
Problem
Submissions

Problem: Fair Distribution of Cookies

med
30 min
Try to solve the Fair Distribution of Cookies problem.

Statement

You are given an integer array cookies, where cookies[i] denotes the number of cookies in the iextthi^{ ext{th}} bag. You are also given an integer k representing the number of children to whom all cookie bags must be distributed.

Every bag of cookies must be given to exactly one child and cannot be split.

The unfairness of a distribution is defined as the maximum total number of cookies obtained by any single child in that distribution.

Return the minimum unfairness of all possible distributions.

Constraints:

  • 2≤2 \leq cookies.length ≤8\leq 8

  • 1≤1 \leq cookies[i] ≤105\leq 10^5

  • 2≤2 \leq k ≤\leq cookies.length

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Fair Distribution of Cookies

med
30 min
Try to solve the Fair Distribution of Cookies problem.

Statement

You are given an integer array cookies, where cookies[i] denotes the number of cookies in the iextthi^{ ext{th}} bag. You are also given an integer k representing the number of children to whom all cookie bags must be distributed.

Every bag of cookies must be given to exactly one child and cannot be split.

The unfairness of a distribution is defined as the maximum total number of cookies obtained by any single child in that distribution.

Return the minimum unfairness of all possible distributions.

Constraints:

  • 2≤2 \leq cookies.length ≤8\leq 8

  • 1≤1 \leq cookies[i] ≤105\leq 10^5

  • 2≤2 \leq k ≤\leq cookies.length