forked from onlybooks/python-algorithm-interview
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path82-1.py
More file actions
16 lines (12 loc) · 410 Bytes
/
82-1.py
File metadata and controls
16 lines (12 loc) · 410 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from typing import List
class Solution:
def findContentChildren(self, g: List[int], s: List[int]) -> int:
g.sort()
s.sort()
child_i = cookie_j = 0
# 만족하지 못할 때까지 그리디 진행
while child_i < len(g) and cookie_j < len(s):
if s[cookie_j] >= g[child_i]:
child_i += 1
cookie_j += 1
return child_i