![alt text]

```
int findContentChildren(vector<int>& g, vector<int>& s) {
int *gf = new int[g.size()], *cs = new int[s.size()], child = 0, cookie = 0;
for(int i = 0; i < g.size(); i ++) gf[i] = g[i];
for(int i = 0; i < s.size(); i ++) cs[i] = s[i];
sort(gf, gf + g.size());
sort(cs, cs + s.size());
while(child < g.size() && cookie < s.size()){
if(gf[child] <= cs[cookie]){
child ++;
}
cookie ++;
}
return child;
}
```

Because using a vector is inefficient, I construct two array to deal with it.