Assign Cookies

Greedy · Make the locally safe choice · Easy · about 16 min

Why it matters

Greedy is about proving why a local choice does not harm the future.

How it connects

Some problems do not need search: after sorting, one sensible choice can be safe forever.

Try first

Sort both lists. Which cookie should you give the least demanding child?

Interview cue

Sorting exposes the safe local choice; then both pointers only move forward.