Cannot pass the case [2,1,1,3,3], 4 (Combination Sum II)


  • 0
    M

    Dear all:

    This is closely related to my previous post "Cannot pass the case [4, 3, 10], 10 (Combination Sum)" which is right below this post.

    With some slight modifications on Combination Sum, I implemented Combination Sum II;

    this time, again I have passed 171/172 of the test cases and was stuck with the last one [2,1,1,3,3], 4

    The shown error message is as below:

    Input: [2,1,1,3,3], 4

    Output: [[1,1,2],[1,3],[4]]

    Expected: [[1,1,2],[1,3]]

    As can be seen, this error is very similar to the one that I had in "Cannot pass the case [4, 3, 10], 10 (Combination Sum)", which shows the followign error message:

    Input: [4,3,10], 10

    Output: [[3,3,4],[10],[10]]

    Expected: [[3,3,4],[10]]

    Both have the redundant target value in the output and both happen in the last test case.

    Again in this case, on my local computer with compiler information (g++ follow the C++11 ISO C++ language standard [-std=c++11]), the result is correct and is [[1,1,2],[1,3]] instead of that indicated by leetCode, [[1,1,2],[1,3],[4]]

    Now I tend to think there is an error in the leetCode examination.

    Does anyone have the same type of error as mine ?

    Thanks for any response.


Log in to reply
 

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