public class Solution {
public int findContentChildren(int[] g, int[] s) {
Arrays.sort(g);
Arrays.sort(s);
int idxG = 0, idxS = 0;
while(idxG<g.length && idxS < s.length ) {
if (g[idxG]<=s[idxS]) {
idxG ++;
idxS ++;
}
else
idxS ++;
}
return idxG;
}
}
转载请注明原文地址: https://ju.6miu.com/read-3069.html