Assign cookies to children where each child needs minimum greed factor. Maximize satisfied children.

Input: g=[1,2,3], s=[1,1] → Output: 1. Only child with greed 1 can be satisfied. Input: g=[1,2], s=[1,2,3] → Output: 2. Both children can be satisfied.

Sort both arrays. Use two pointers: try to satisfy each child with the smallest sufficient cookie.

public int findContentChildren(int[] g, int[] s) { Arrays.sort(g); Arrays.sort(s); int i = 0, j = 0; while (i < g.length && j < s.length) { if (s[j] >= g[i]) i++; j++; } return i; }