Open Shawngbk opened 7 years ago
public class Solution { public int findContentChildren(int[] g, int[] s) { Arrays.sort(g); Arrays.sort(s);
int pointerG = 0, pointerS = 0; while(pointerG < g.length && pointerS < s.length) { if(g[pointerG] <= s[pointerS]) { pointerG++; pointerS++; } else { pointerS++; } } return pointerG; }
}
public class Solution { public int findContentChildren(int[] g, int[] s) { Arrays.sort(g); Arrays.sort(s);
}