Fair Distribution of Cookies

Given bags of cookies and k children, distribute each bag to exactly one child to minimize the maximum total cookies received by any single child. Every bag must be assigned. Since k <= cookies.length, the answer is always defined, and one valid assignment gives every child one bag.

Examples
Input: [[8,15,10,20,8],2]
Output: 31
Hints

Fair Distribution of Cookies

Given bags of cookies and k children, distribute each bag to exactly one child to minimize the maximum total cookies received by any single child. Every bag must be assigned. Since `k <= cookies.length`, the answer is always defined, and one valid assignment gives every child one bag.