```
public class Solution {
public int findContentChildren(int[] g, int[] s) {
Arrays.sort(g);
Arrays.sort(s);
int x=0,sum=0;
for(int i=0;i<g.length;i++){
for(int j=x;j<s.length;j++){
if(g[i]<=s[j]){
x=j+1;
sum++;
break;
}
}
}
return sum;
}
}
```