Skip to content

Commit

Permalink
Time: 44 ms (8.61%), Space: 17.9 MB (15.57%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Dipendra-Raghav committed Jan 1, 2024
1 parent b860e19 commit ee86c42
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions 0455-assign-cookies/0455-assign-cookies.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class Solution {
public:
int findContentChildren(vector<int>& g, vector<int>& s) {
sort(s.begin(),s.end());
sort(g.begin(),g.end());
int ans=0;
int j=0;
for(int i=0;i<s.size();i++)
{
if(i>=s.size() || j>=g.size())break;
if(s[i]>=g[j])
{
ans++;
j++;
}

}
return ans;

}
};

0 comments on commit ee86c42

Please sign in to comment.