The description of the problem is problematic and misleading


  • 0
    W

    e.g. if I have an input tree of
    [1, 2, 3, 4, null, 5, 6, null, null, null, null, 7]
    that looks like this where the right nodes are 3 and 6:
    0_1508107448899_008425c8-8b37-47f6-a1f2-7f535b99fbbd-image.png

    after running the function, the correct output would be:
    [4,null,2,3,1,5,6,null,null,null,null,7]
    that looks like this:
    0_1508107487035_e12725c5-57ea-473c-9104-84e2c2e0771a-image.png
    where the left nodes are 3, 5 and 7.

    You'll notice that the right noes in the original tree (3 and 6) are not always left nodes in the new tree (3 is a left node but 6 is actually a right node).

    Notice what the problem says that the right nodes become left nodes in the new tree, which doesn't fit in the algorithm that the solution gives. The description of the problem is somewhat problematic and misleading.


Log in to reply
 

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