class Solution
{
public:
int findContentChildren(vector<int>& g, vector<int>& s)
{
int gi{0},si{0},count{0};
sort(g.begin(),g.end()); //等价于 sort(begin(g),end(g),less<>);
sort(s.begin(),s.begin());
while(gi<g.size()&&si<s.size())
{
if(s[si]>=g[gi])
{
++count;
++si;
++gi;
}
else if(s[si]<g[gi])
{++si;}
}
return count;
}
};