Assign Cookies
Child i is happy only with a cookie of size at least g[i] (the list g). The list s holds cookies of the sizes listed. Each child gets at most one cookie and each cookie goes to at most one child.
Return the largest number of children you can make happy.
Example 1
g [1,2,3]
s [1,1]
returns 1
Two small cookies can only satisfy the child who needs 1.
Example 2
g [1,2]
s [1,2,3]
returns 2
Both children can be satisfied.
Constraints
0 <= len(g), len(s) <= 201 <= g[i], s[j] <= 20
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.