思路:
// @Title: 分发饼干 (Assign Cookies)
// @Author: qisiii
// @Date: 2024-09-22 00:45:27
// @Runtime: 8 ms
// @Memory: 47.3 MB
// @comment:
// @flag:
class Solution {
public int findContentChildren(int[] g, int[] s) {
Arrays.sort(g);Arrays.sort(s);
int s1=s.length-1;
int result=0;
for(int i=g.length-1;i>=0;i--){
if(s1<0){
break;
}
if(g[i]<=s[s1]){
s1--;
result++;
}
}
return result;
}
}