@@ -0,0 +1,990 @@
+public class _0099RecoverBinarySearchTree %7B%0A  private TreeNode n1, n2;%0A%0A  public void recoverTree(TreeNode root) %7B%0A    inOrder(null, root);%0A    int val = n1.val;%0A    n1.val = n2.val;%0A    n2.val = val;%0A  %7D%0A%0A  private TreeNode inOrder(TreeNode parent, TreeNode root) %7B%0A    if (root == null) %7B%0A      return null;%0A    %7D%0A    TreeNode lastNode = inOrder(parent, root.left);%0A    lastNode = lastNode == null ? parent : lastNode;%0A    if (lastNode != null && lastNode.val %3E root.val) %7B%0A      if (n1 == null) %7B%0A        n1 = lastNode;%0A      %7D%0A      n2 = root;%0A    %7D%0A    TreeNode finalNode = inOrder(root, root.right);%0A    finalNode = finalNode == null ? root : finalNode;%0A    return finalNode;%0A  %7D%0A%0A  public class TreeNode %7B%0A      int val;%0A      TreeNode left;%0A      TreeNode right;%0A      TreeNode() %7B%7D%0A      TreeNode(int val) %7B this.val = val; %7D%0A      TreeNode(int val, TreeNode left, TreeNode right) %7B%0A          this.val = val;%0A          this.left = left;%0A          this.right = right;%0A      %7D%0A  %7D%0A%7D%0A

Add _0099RecoverBinarySearchTree