Tap here to switch tabs
Problem
Submissions

Problem: Ones and Zeroes

med
30 min
Try to solve the Ones and Zeroes problem.

Statement

Given an array of binary strings strs and two integers m and n, return the size of the largest subset of strs such that the subset contains at most m zeros and at most n ones.

A subset is formed by selecting any number of strings from strs, without changing their order.

findMaxForm(strs, m, n) returns the maximum possible size of such a subset.

Note: A binary string contains only the characters '0' and '1'.

Constraints:

  • 1≤1 \leq strs.length ≤600\leq 600

  • 1≤1 \leq strs[i].length ≤100\leq 100

  • strs[i] consists only of digits '0' and '1'.

  • 1≤1 \leq m, n ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Ones and Zeroes

med
30 min
Try to solve the Ones and Zeroes problem.

Statement

Given an array of binary strings strs and two integers m and n, return the size of the largest subset of strs such that the subset contains at most m zeros and at most n ones.

A subset is formed by selecting any number of strings from strs, without changing their order.

findMaxForm(strs, m, n) returns the maximum possible size of such a subset.

Note: A binary string contains only the characters '0' and '1'.

Constraints:

  • 1≤1 \leq strs.length ≤600\leq 600

  • 1≤1 \leq strs[i].length ≤100\leq 100

  • strs[i] consists only of digits '0' and '1'.

  • 1≤1 \leq m, n ≤100\leq 100