455. 分发饼干 题目链接:https://leetcode.cn/problems/assign-cookies/description/ Java123456789101112131415161718class Solution { public int findContentChildren(int[] g, int[] s) { Arrays.sort(g); Arrays.sort(s); int sum = 0; int i = 0, j = 0; while( i < s.length && j < g.length) { if (s[i] < g[j] ) { i++; } else { sum ++; j++; i++; } } return sum; }} leetcode算法题 #Java 455. 分发饼干 https://pisces34.github.io/2025/04/24/leetcode/455/ 发布于 2025年4月24日 许可协议 3536. 两个数字的最大乘积 上一篇 852. 山脉数组的峰顶索引 下一篇