Code Room
CodingEasycod-g1436
Subject GreedyLevel Entry–Mid~12 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

A gym hands out towels at the front desk. requests[i] is the minimum towel size member i will accept, and towels[j] is the size of towel j. Each member receives at most one towel and each towel goes to at most one member; a member is satisfied only when their towel is at least their requested size. Return the maximum number of satisfied members. Example: requests [1, 2, 3] with towels [1, 1] satisfies 1 member.

Implement
max_satisfied(requests: list[int], towels: list[int]) → int
Examples
in[[1,2,3],[1,1]]out1
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.