class Solution(object):
    def findContentChildren(self, g, s):
        """
        :type g: List[int]
        :type s: List[int]
        :rtype: int
        """
        if g == [] or s == []:
            return 0

        s.sort()
        g.sort()
        ans = 0
        j = 0

        for greed in g:
            if (j == len(s)):
                return ans   #early stop

            while (j != len(s)) and (greed > s[j]):
                j += 1

            if (j != len(s)) :
                ans += 1
                j += 1
        return ans

da366bea45a29656ef2773d0b7a9339e56514a89
<mask token>

class Solution(object):
    <mask token>

class Solution(object):

    def findContentChildren(self, g, s):
        """
        :type g: List[int]
        :type s: List[int]
        :rtype: int
        """
        if g == [] or s == []:
            return 0
        s.sort()
        g.sort()
        ans = 0
        j = 0
        for greed in g:
            if j == len(s):
                return ans
            while j != len(s) and greed > s[j]:
                j += 1
            if j != len(s):
                ans += 1
                j += 1
        return ans

class Solution(object):
    def findContentChildren(self, g, s):
        """
        :type g: List[int]
        :type s: List[int]
        :rtype: int
        """
        if g == [] or s == []:
            return 0

        s.sort()
        g.sort()
        ans = 0
        j = 0

        for greed in g:
            if (j == len(s)):
                return ans   #early stop

            while (j != len(s)) and (greed > s[j]):
                j += 1

            if (j != len(s)) :
                ans += 1
                j += 1
        return ans
