C++ implement 59ms Accepted

@fanbinjim Could you explain why the second STL sorting call is significantly faster?

@fanbinjim Might optimize this code by assigning local variables
int m = g.size(), n = s.size();
and usem
andn
in sort and while conditions. I achieved 56ms withclass Solution { public: int findContentChildren(vector<int>& g, vector<int>& s) { int i = 0, j = 0, m = g.size(), n = s.size(); sort(&g[0], &g[0]+m); sort(&s[0], &s[0]+n); while (i < m && j < n) { if (s[j] >= g[i]) i++; j++; } return i; } };