Wrong Sample Test Cases


  • 0
    G

    My code was failing because in the sample test case, one node has edges to other node multiple times.
    Is it a valid graph? How can a node can have multiple edges to other node?
    please correct the test cases.

    Test case :
    Input: {0,1,5#1,2,5#2,3#3,4,4#4,5,5#5}
    Output: {0,1,5#1,2,5#2,3#3,4,4#4,5,5,5,5#5}
    Expected: {0,1,5#1,2,5#2,3#3,4,4#4,5,5#5}

    How can node with label 3 can have 4 in its neighbor list more than once?


  • 1
    Y

    There is a type of graph called multigraph. It allows multi-edges.


  • 0
    G

    So do you think it should be mentioned in question also?


  • 0
    Y

    I don't think it's necessary. The example mentioned in the question contains a self-cycle, which implies that multigraphs should be considered.


  • 0
    D
    This post is deleted!

Log in to reply
 

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