Code RoomOnes and zeroes
MediumPrep Room Coding #89

Ones and zeroes

CodingAlgorithms & data structuresMid–Senior~25 min

You are given an array strs of binary strings and two budgets m and n. Choose the largest possible subset of strs such that the total number of '0' characters across the chosen strings is at most m and the total number of '1' characters is at most n. Return the size of that largest subset. There are at most 600 strings, each of length at most 100, and m, n are at most 100.

Implement
find_max_form(strs: list[str], m: int, n: int) → int
Examples
in[["10","0001","111001","1","0"],5,3]out4
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 25 min
InputExpectedGot
[["10","0001","111001","1","0"],5,3]4not run yetsample