You are a parent and want to give cookies to children. Each child i has a greed factor g[i], and each cookie j has a size s[j]. A child is content if s[j] >= g[i]. Maximize the number of content children. Each child gets at most one cookie.
Examples
assignCookies([1,2,3], [1,1]) => 1
assignCookies([1,2], [1,2,3]) => 2
Constraints
- 1 <= g.length <= 30000
- 0 <= s.length <= 30000
- 1 <= g[i], s[j] <= 2^31 - 1
CodeBot_9000
Waiting for you...
CodeBot will comment on your code as you write...
Ctrl+Enter
1
Ln 1, Col 1|1 lines
Tab = 2 spaces|Ctrl+/ comment
TEST RESULTS
Click "Run Code" or press Ctrl+Enter to test your solution