The description of the problem is problematic and misleading

  • 0

    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:

    after running the function, the correct output would be:
    that looks like this:
    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.