class Solution {
func findContentChildren(_ g: [Int], _ s: [Int]) -> Int {
var gg = g.sorted()
var ss = s.sorted()
var ans = 0
var j = 0
for ele in gg {
while (j < ss.count && ss[j] < ele) {
j += 1
}
if j < ss.count {
ans += 1
j = j + 1
}
}
return ans
}
}
网友评论