Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Assign Cookies

Easy Greedy

Each child i has a greed factor g[i] (minimum cookie size that satisfies them) and each cookie j has a size s[j]. A cookie can go to at most one child. Print the maximum number of children that can be satisfied.

Constraints

1 <= n, m <= 3 * 10^4 1 <= g[i], s[j] <= 2^31 - 1

Discussion

No discussions yet.

Rewards · v2.1

Join Shalyam Newsletter

Get exclusive insights with every issue: education, research and innovation news.

One email a week. Unsubscribe any time.