What is the member storing the nodes value of ListNode called?


  • 1
    C

    How do you get the value from a node? The class is "ListNode" but it is defined no where. I have tried node->value or node->data but neither works?


  • 0
    C

    I forgot to mention I use C++


  • 0
    C

    I have found the answer, it is node->val


  • 0

    Sorry for the inconvenience. I have fixed this by including the definition of ListNode in the default code definition comments. You can click on the reload code definition button above the code editor to view the newest code definition.


Log in to reply
 

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