贪心
class Solution {
public:
int findContentChildren(vector<int>& g, vector<int>& s) {
sort(g.begin(),g.end());
sort(s.begin(),s.end());
int cd=0;
int ck=0;
while(cd!=g.size() && ck!=s.size()){
if(g[cd]<=s[ck]) ++cd;
ck++;
}
return cd;
}
};
标签:sort,ck,Cookies,end,Assign,int,cd,LeetCode
From: https://www.cnblogs.com/poteitoutou/p/16870539.html