### Maximize the Children Satisfied by Cookies
You have children with minimum acceptable cookie sizes `g` and cookies with sizes `s`. Child `i` is satisfied by cookie `j` exactly when `s[j] >= g[i]`.
Each child can receive at most one cookie, and each cookie can be given to at most one child. Cookies cannot be split or combined. Some children and cookies may remain unassigned.
Return the maximum number of children that can be satisfied. Return only the count; you do not need to return the assignments.
### Function Interface
```cpp
class Solution {
public:
int findContentChildren(vector<int>& g, vector<int>& s);
};
```
### Examples
**Example 1**
```text
Input: g = [2,4,4,7], s = [1,4,5]
Output: 2
```
The cookie of size `1` cannot satisfy any child. Give sizes `4` and `5` to two children whose requirements they meet. No assignment can satisfy more than two children because only two cookies are large enough for anyone.
**Example 2**
```text
Input: g = [3,3,8], s = [3,3,9,10]
Output: 3
```
Give the two size-`3` cookies to the two children requiring `3`, and size `9` to the child requiring `8`. All three children are satisfied; the size-`10` cookie can remain unused.
### Constraints
- `1 <= g.size() <= 30000`.
- `0 <= s.size() <= 30000`.
- `1 <= g[i], s[j] <= 2147483647`.
### Clarifications
- A cookie equal to a child's requirement is sufficient.
- Different children can have the same requirement, and different cookies can have the same size. They are still separate children and cookies.
- If there are no cookies, the result is `0`.
- The order of the input arrays does not restrict which child can receive which cookie.
### What a Strong Answer Covers
- The maximum possible satisfied count and a justification that a better assignment cannot exist.
- Correct treatment of equality, repeated values, empty cookie lists, and unused cookies.
- Time and space costs that support both array-size limits and the full positive signed 32-bit value range.
Overview: Assign cookies to maximize satisfied children while respecting each minimum size requirement and using each child and cookie at most once.
You have children with minimum acceptable cookie sizes g and cookies with sizes s. Child i is satisfied by cookie j exactly when s[j] >= g[i].
Each child can receive at most one cookie, and each cookie can be given to at most one child. Cookies cannot be split or combined. Some children and cookies may remain unassigned.
Return the maximum number of children that can be satisfied. Return only the count; you do not need to return the assignments.
Function Interface
class Solution {
public:
int findContentChildren(vector<int>& g, vector<int>& s);
};
Examples
Example 1
Input: g = [2,4,4,7], s = [1,4,5]
Output: 2
The cookie of size 1 cannot satisfy any child. Give sizes 4 and 5 to two children whose requirements they meet. No assignment can satisfy more than two children because only two cookies are large enough for anyone.
Example 2
Input: g = [3,3,8], s = [3,3,9,10]
Output: 3
Give the two size-3 cookies to the two children requiring 3, and size 9 to the child requiring 8. All three children are satisfied; the size-10 cookie can remain unused.
Constraints
1 <= g.size() <= 30000
.
0 <= s.size() <= 30000
.
1 <= g[i], s[j] <= 2147483647
.
Clarifications
A cookie equal to a child's requirement is sufficient.
Different children can have the same requirement, and different cookies can have the same size. They are still separate children and cookies.
If there are no cookies, the result is
0
.
The order of the input arrays does not restrict which child can receive which cookie.
What a Strong Answer Covers Guidance
The maximum possible satisfied count and a justification that a better assignment cannot exist.
Correct treatment of equality, repeated values, empty cookie lists, and unused cookies.
Time and space costs that support both array-size limits and the full positive signed 32-bit value range.