Recover binary tree

can you plz drop any hint to approch this que

hi Ashish,
You can do in-order taversal of the binary tree and do some observation there.
Please let me know if face any difficulty.

okay by doing inorder o know which two nodes are swapped ,so how can i now make tree , should sorting inorder and build tree from sorted array will work ???

hi anshul,
When you will do inorder of the array store that it in array and try to print that array.
When you will observe that array carefully you will notice wrong values at two points,those are the two points to be swapped.

https://ide.codingblocks.com/s/319211 sir is this approch is fine or should i optimise it more

although its passing all test cases