you give root binary search tree BST value exactly nod tree swap mistake Recover tree change structure example 1input root 13nullnull2output 31nullnull2explanation 3 leave child 1 3 1 swap 1 3 make BST validExample 2input root 314nullnull2output 214nullnull3explanation 2 right subtree 3 2 3 swap 2 3 make BST valid ConstraintsThe number nod tree range 2 1000231 Nodeval 231 1 follow A solution on space pretty straightforward could devise constant o1 space solution