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