275. Assign Cookies
EasyGreedySorting
Child i is content with a cookie of size ≥ greed[i]. Each child gets at most one cookie. Print the maximum number of content children.
Input format
Line 1: n m Line 2: n greed factors Line 3: m cookie sizes
Output format
The maximum count.
Example 1
Input
3 2 1 2 3 1 1
Output
1
Example 2
Input
2 3 1 2 1 2 3
Output
2
Constraints
1 ≤ n, m ≤ 10⁵
Read input from standard input and print the answer to standard output. Your code is judged against 3 test cases, most of them hidden.
Loading the MyLoginn IDE…