You want to give cookies to children, at most one cookie each. Child i has a greed factor g[i], the smallest cookie size that will make them content, and cookie j has size s[j]. Child i is content if given a cookie with s[j] >= g[i]. Return the maximum number of content children.
You want to give cookies to children, at most one cookie each. Child i has a greed factor g[i], the smallest cookie size that will make them content, and cookie j has size s[j]. Child i is content if given a cookie with s[j] >= g[i]. Return the maximum number of content children.
Example 1:
Input: {"g":[1,2,3],"s":[1,1]}
Output: 1
Constraints:
1≤g.length≤3×104
0≤s.length≤3×104
1≤g[i],s[j]≤231−1
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"g":[1,2,3],"s":[1,1]}
3 children and 2 cookies, in no particular order yet.