Another Python Solution


  • 0
    F

    '''
    def findContentChildren(self, g, s):
    g.sort(reverse = True)
    s.sort(reverse = True)
    count = 0

        while ((len(s)>0) & (len(g)>0)):
            #print(g,s)
            if s[0]<g[len(g)-1]:
                break
            if s[0] >= g[0]:
                count = count + 1
                s.pop(0)
                g.pop(0)
            else:
                g.pop(0)
    

    '''


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.