What is the tree of the array


  • 1
    E

    The input is [1,2,2,3,null,null,3,4,null,null,4]
    but i can't understand the output tree from the array

    Does the tree like this?

             1
          2     2 
       3  x   x   3  
     4 x x 4

  • 1
    O

    Same confusion here. I'm guessing that that last "4" is attempted to be attached as the right child of the "null" and consequentially getting removed.


  • 0
    S
                1
               /  \ 
            2      2 
           / \      / \
        3    x   x    3
       / \           /   \
      4   x         x      4

Log in to reply
 

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