[Leetcode] Ones and zeroes one and 0

Source: Internet
Author: User

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

For now, suppose is a dominator of M and 0s N 1s respectively. On the other hand, there is a array with strings consisting of only 0s and 1s .

Now your task was to find the maximum number of strings, the can form with given M and 0s N 1s . Each and can is used at the most 0 1 once.

Note:

    1. The given numbers of and would 0s 1s both not exceed100
    2. The size of given string array won ' t exceed 600 .

Example 1:

Input:array = {"Ten", "0001", "111001", "1", "0"}, m = 5, n = 3output:4explanation:this is totally 4 strings can is for Med by the using of 5 0s and 3 1s, which is "10," 0001 "," 1 "," 0 "

Example 2:

Input:array = {"Ten", "0", "1"}, M = 1, n = 1output:2explanation:you could form "Ten" and then you ' d has nothing left. Better form "0" and "1".

S

[Leetcode] Ones and zeroes one and 0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.