Code RoomTowel satisfaction
EasyPrep Room Coding #634

Towel satisfaction

CodingAlgorithms & data structuresEntry–Mid~12 min

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.

0:00 of about 12 min
InputExpectedGot
[[1,2,3],[1,1]]1not run yetsample