Assign Cookies
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You want to hand out cookies to children. Child i has a greed factor g[i], the minimum cookie size that will satisfy them, and cookie j has size s[j]. Child i is content if they receive a cookie with s[j] >= g[i].
Each child receives at most one cookie and each cookie goes to at most one child. Return the maximum number of content children you can achieve.
Examples
Constraints
- 0 <= g.length <= 3 * 10^4
- 0 <= s.length <= 3 * 10^4
- 1 <= g[i], s[j] <= 2^31 - 1
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.