From 3fd92a4905c67df6fdf4c2238bd8c4f5f03fb595 Mon Sep 17 00:00:00 2001 From: jojoo15 <75017412+jojoo15@users.noreply.github.com> Date: Mon, 7 Jun 2021 20:55:40 +0200 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=200455.=20=E5=88=86=E5=8F=91?= =?UTF-8?q?=E9=A5=BC=E5=B9=B2=20python3=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化 0455. 分发饼干 python3版本 --- problems/0455.分发饼干.md | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/problems/0455.分发饼干.md b/problems/0455.分发饼干.md index ecf7f132..4814d414 100644 --- a/problems/0455.分发饼干.md +++ b/problems/0455.分发饼干.md @@ -134,22 +134,17 @@ class Solution { ``` Python: -```python +```python3 class Solution: def findContentChildren(self, g: List[int], s: List[int]) -> int: - #先考虑胃口小的孩子 g.sort() s.sort() - i=j=0 - count = 0 - while(i= g[res]: #小饼干先喂饱小胃口 + res += 1 + return res ``` - Go: Javascript: