fix:分发饼干

上级 9cb75913
"""
分发饼干
"""
from typing import List
class Solution:
def findContentChildren(self, g: List[int], s: List[int]) -> int:
g.sort()
s.sort()
i = 0
j = 0
count = 0
while i < len(g) and j < len(s):
if g[i] <= s[j]:
count += 1
i += 1
j += 1
return count
if __name__ == '__main__':
result = Solution().findContentChildren([1, 2, 3], [1, 1])
print(result)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册