Missing Test Cases


  • 2
    W

    I have read some solution online and notice there are some bugs. However, their solutions can pass the test.
    Input:
    [1,2,4,8,9,72]
    Expected:
    [1,2,4,8,72]
    Wrong:
    [1,2,4,72]
    The set up is the same, they use hashmaps to record with each number as the largest number in the set, what is largest divisible subset.
    1:[1]
    2:[1,2]
    4:[1,2,4]
    8:[1,2,4,8]
    9:[1,9]
    In their solution, when they search to 72 and go backwards to search if there are divisor of 72 in previous numbers, they stop at the first divisor they come across, which is 9 in this case. That is not right.
    so they got
    72:[1,9,72]

    So I think some test cases should be added here


  • 1

    Thanks. Could you please paste the link of few solutions which failed your test cases?


  • 0
    W

    It is in Chinese. http://blog.csdn.net/lmy690858904/article/details/51785238

    The code is inside the page in Java, and it passes the test while it failed on the customized test cases above.

    Thanks for replying.


  • 0

    @wad Thank you very much for improving LeetCode. I have just added the test case.


Log in to reply
 

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