Greedy: give the smallest adequate cookie to each child.
Sort both children (by greed) and cookies (by size). Match the least greedy child with the smallest cookie that satisfies them.
Why this works: giving a larger cookie than necessary wastes it. Always use the smallest sufficient cookie.
Two pointers: one for children, one for cookies. Move cookie pointer until you find one that works for the current child.