What exactly does {-1} mean!


  • 3
    P

    I got Runtime error for this test case even with the below code:

    UndirectedGraphNode *cloneGraph(UndirectedGraphNode *node) {
    return NULL;
    }

    Can someone tell me what does {-1} mean here and why I got Runtime error? It has been so frustrating.


  • 0
    C

    It means the label of the input node is -1 and has no neighbor, while your return value is NULL, so you get a Runtime error, you should return a deep copy.


Log in to reply
 

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