Test case failed - Can a TreeNode be under a null?


  • 0
    M

    42/47 test cases passed. A failed one shows this input:

    [4,5,null,4,6,null,null,7,null,8,null,null,9,10]

    What does this tree look like? Can a TreeNode be under a null? (node 9 and node 10)

    //                     [4,
    //           5,               null,
    //   4,          6,        null,  null,
    // 7,null,     8,null,  null, 9,  10]

  • 1

    Click the "how LeetCode OJ serializes a binary tree" link and read there, particularly the third example.


  • 1
    S

    This case represents the following tree:

                                4
                              /   \
                             5     null
                          /     \     
                        4         6         
                      /  \       / \
                    null null   7  null
                               / \
                              8  null
                             / \
                          null  9
                               / \
                              10  null

Log in to reply
 

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