diff --git "a/14_\345\210\267\351\242\230/day03/problem_solving_23.py" "b/14_\345\210\267\351\242\230/day03/problem_solving_23.py" new file mode 100644 index 0000000000000000000000000000000000000000..93efc60e6d5c4bbe230ea0f8fff46df428a5659a --- /dev/null +++ "b/14_\345\210\267\351\242\230/day03/problem_solving_23.py" @@ -0,0 +1,24 @@ +""" +分发饼干 +""" +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)