We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
How can you assume that the root is 1 and another child is 2? And why are you swapping 1 twice? And what's the meaning of the -1 -1, -1 -1. Makes no sense to me.
Swap Nodes [Algo]
You are viewing a single comment's thread. Return to all comments →
Input is somehow ambiguous, for example
3
2 3
-1 -1
-1 -1
2
1
1
How can you assume that the root is 1 and another child is 2? And why are you swapping 1 twice? And what's the meaning of the -1 -1, -1 -1. Makes no sense to me.