Is the # between 5 and 6 considered a hole? If so, are we supposed to connect 5 to 6?


  • 0
    B

    If there is a NULL inside the tree (e.g. between 5 and 6), will 5 be connected to 6?


  • 1
    M

    The answer is both yes and no. It is a hole, and you would need to connect 5 to 6, but the situation will not occur in this problem. It will, however, occur in Populating Next Right Pointers II.


  • 0
    B

    hi @mike3, please looked at the related question shown in my question. You showed me that the actual tree shape in that question, and it seems like there is a # in the middle of the tree..


  • 0
    M

    And it occurred in this problem, not its sequel? If it is, that's very strange. Still, you do need to connect them, even if there are holes.


  • 0
    B

    It is very strange that I didn't connect 5 and 6 but the answer is accepted... I have no idea why...


  • 0
    M

    I've changed the original question's answer. I was using the normal tree serialization. This problem has a slight change in the process. The new tree lacks the holes.


  • 0
    B

    Now I understand it. Thank you so much @mike3 for your patience in answering my questions!


Log in to reply
 

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