Greedy Algorithms - Assign Cookies
Given the Python function below implementing the greedy Assign Cookies solution, what is the output when
g = [2, 3, 4] and s = [1, 2, 3]? def findContentChildren(g, s):
g.sort()
s.sort()
i = j = 0
while i < len(g) and j < len(s):
if s[j] >= g[i]:
i += 1
j += 1
return i