I can't understand this instance


  • 0
    J

    I can't understand this instance:

    ["10","0001","111001","1","0"]
    3
    4

    the expected answer is 3.
    But I think the answer is 2 ["111001","0"].


  • 0
    G

    This question could be clear to mention this: you can use one string multiple times, but has to use as many unique strings as possible.

    Try this test case in your console:

    ["10", "0", "1"]
    10
    14
    

    Expected result is: 3

    means you can use each element in ["10", "0", "1"] at least once, to get m=2, n=2, then for remaining 0s and 1s, use what ever you want from the array, but in total only 3 distinct string are used.


  • 0
    J

    Thanks, I get it.
    At the first time, I treated this problem as a two dimension subset sum problem, and i think each string can be used only once.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.