455. 分发饼干
Me
func findContentChildren(g []int, s []int) int {
if len(s) == 0 {
return 0
}
sort.Ints(g)
sort.Ints(s)
var count, i, j int = 0, 0, 0
for {
if g[i] <= s[j] {
i, j, count = i+1, j+1, count+1
} else {
j++
}
if i >= len(g) || j >= len(s) {
return count
}
}
return count
}
来源:CSDN
作者:寇浩哲
链接:https://blog.csdn.net/csdn_kou/article/details/104117341