Assign Cookies
两个数组分别排序后利用双指针往前移就可以了
class Solution(object):
def findContentChildren(self, g, s):
"""
:type g: List[int]
:type s: List[int]
:rtype: int
"""
g.sort()
s.sort()
curG, curS = 0, 0
n, m = len(g), len(s)
while curG < n and curS < m:
if s[curS] >= g[curG]:
curG += 1
curS += 1
return curG