We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf20089 commit f6d8e29Copy full SHA for f6d8e29
0455-assign-cookies/0455-assign-cookies.py
@@ -0,0 +1,19 @@
1
+from typing import List
2
+
3
4
+class Solution:
5
+ def findContentChildren(self, greedyChildren: List[int], cookiesSize: List[int]) -> int:
6
+ greedyChildren.sort()
7
+ cookiesSize.sort()
8
+ cookieIdx = 0
9
+ childrenIdx = 0
10
+ while cookieIdx < len(cookiesSize) and childrenIdx < len(greedyChildren):
11
+ if cookiesSize[cookieIdx] >= greedyChildren[childrenIdx]:
12
+ childrenIdx += 1
13
+ cookieIdx += 1
14
+ return childrenIdx
15
16
17
+greedyChildren = [1, 2, 3]
18
+cookiesSize = [1, 1]
19
+print(Solution().findContentChildren(greedyChildren, cookiesSize))
0 commit comments