Find the largest subset of binary strings with at most m ones and n zeros in total.
Unlock detailed company stats for this questionUpgrade
Given an array of binary strings and two integers m and n, find the size of the largest subset such that the total number of 1s across the subset is at most m and the total number of 0s is at most n.
Example 1: strs = ["100","10","1","11","111"], m = 3, n = 0 gives 2 via ["1","11"]. Example 2: strs = ["10","0001","111001","1","0"], m = 5, n = 3 gives 4 via ["10","0001","1","0"]. Example 3: strs = ["10","1","0"], m = 1, n = 1 gives 2 via ["1","0"].
Community answers
No answers contributed by the community yet.
Related questions
Find the length of the longest substring with at most k distinct characters.Find the maximum number of equal-bit pairs in a subsequence of a binary string.Find the longest chain of 1s in a binary string after replacing one character.Related courses

Course

Course
Course
