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 ofm0s
andn1s
respectively. On the other hand, there is an array with strings consisting of only0s
and1s
.
Now your task is to find the maximum number of strings that you can form with givenm0s
andn1s
. Each0
and1
can be used at mostonce.
Note:
The given numbers of
0s
and
1s
will both not exceed
100
The size of given string array won't exceed
600
.
Example 1:
Example 2:
分析
01背包,把value拆成0,1,变成2个循环而已。记得倒序
这里value范围必须是cnt0->m cnt1>n???
Last updated