Practice Assign Cookies
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor g[i], which is the minimum size of a cookie that the child will be content with; and each cookie j has a size s[j]. If s[j] >= g[i], we can assign the cookie j to the child i, and the child i will be content. Your goal is to maximize the number of your content children and output the maximum number. Example 1: Example 2: Constraints: Note: This question is the same as 2410: Maximum Matching of Players With Trainers.
Source: Assign Cookies on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
g = [1,2,3], s = [1,1]
1
# Example 2
g = [1,2], s = [1,2,3]
2
Constraints
Related LeetCode Problems
Practice more problems similar to Assign Cookies.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.