Ones and Zeroes

474. Ones and Zeroes

In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue.

For now, suppose you are a dominator of m0s and n1s respectively. On the other hand, there is an array with strings consisting of only 0sand 1s.

Now your task is to find the maximum number of strings that you can form with given m0s and n1s. Each 0 and 1 can be used at mostonce.


  1. The given numbers of 0s and 1s will both not exceed 100
  2. The size of given string array won’t exceed 600.

Example 1:

Example 2: