I have read some solution online and notice there are some bugs. However, their solutions can pass the test.
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.
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
So I think some test cases should be added here
Thanks. Could you please paste the link of few solutions which failed your test cases?
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.
@wad Thank you very much for improving LeetCode. I have just added the test case.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.