You are viewing a single comment's thread. Return to all comments →
Amazing! This is exactly what I hoped to find in the comments. Thanks!
what prerequisite i need to solve this question
solve level order traversal first. the logic here is similar.
i'm confused, we have to swap nodes(means that whole node containing its child nodes are also moved form left to right or right to left) or we have to swap nodes data.
We have to swap nodes not their data.
I did the same thing but am getting time out in test cases 6,7,10 and 11. Can any one suggest some thing?
same here bro, i first created a tree then inserted nodes acoordingly on the basis of input then swapped but it is giving timeout in test case 6,7,10,11.
please provide me an update as soon as u get it,and ill do the same