class Solution { public: int findContentChildren(vector<int>& g, vector<int>& s) { int n1=g.size(); int n2=s.size(); int i=0, j=0,res=0; sort(g.begin(),g.end()); sort(s.begin(),s.end()); while(i<n1 && j<n2) { if(g[i]<=s[j]) { i++;j++;res++; } else { j++; } } return res; } };