**Always give the smallest cookie possible to the least greed child**, which doesn't sound like an awesome parent as stated in the problem but fair, don't you think? :-)

```
int findContentChildren(vector<int>& g, vector<int>& s) {
sort(g.begin(), g.end()); sort(s.begin(), s.end()); int i = 0, res = 0;
while (i < s.size() && res < g.size()) if (g[res] <= s[i++]) ++res;
return res;
}
```