class Solution {
public:
int findContentChildren(vector<int>& g, vector<int>& s) {
sort(g.begin(), g.end());
sort(s.begin(), s.end());
int m = g.size()-1, n = s.size()-1,count =0;
while(m>=0&& n>=0)
{
if(g[m]>s[n]) m--;
else{
m--,n--;
count++;
}
}
return count;
}
};
class Solution {
public:
int findContentChildren(vector<int>& g, vector<int>& s) {
sort(g.begin(), g.end());
sort(s.begin(), s.end());
int i =0;
for(int j =0;i<g.size()&& j<s.size();j++)
i += g[i]<=s[j];
return i;
}
};