leetcode分发饼干

在这里插入图片描述

class Solution(object):
    def findContentChildren(self, g, s):
        """
        :type g: List[int]
        :type s: List[int]
        :rtype: int
        """
        g.sort()
        s.sort()
        j=0
        p=0
        l=len(g)
        for i in s:
            if j<l and g[j]<=i:
                p+=1
                j+=1
        return p
        
发布了29 篇原创文章 · 获赞 28 · 访问量 278

猜你喜欢

转载自blog.csdn.net/weixin_45398265/article/details/105151302