@@ -0,0 +1,1447 @@
+/**%0A * Problem: https://leetcode.com/problems/recover-binary-search-tree/%0A * %0A * Definition for a binary tree node.%0A * public class TreeNode %7B%0A *     int val;%0A *     TreeNode left;%0A *     TreeNode right;%0A *     TreeNode(int x) %7B val = x; %7D%0A * %7D%0A */%0Apublic class Solution %7B%0A    public void recoverTree(TreeNode root) %7B%0A        Stack%3CTreeNode%3E swapPair = new Stack%3CTreeNode%3E();%0A        recoverTree(root, swapPair);%0A       %0A        if (swapPair.size() != 0) %7B%0A            TreeNode node1 = swapPair.pop();%0A            TreeNode node2 = swapPair.pop();%0A            int val = node1.val;%0A            node1.val = node2.val;%0A            node2.val = val;%0A        %7D%0A    %7D%0A       %0A    // In-order Tree Traversal.%0A    void recoverTree(TreeNode root, Stack%3CTreeNode%3E swapPair) %7B%0A        if (root == null) return;%0A        recoverTree(root.left, swapPair);%0A        addNodeToStack(swapPair, root);%0A        recoverTree(root.right, swapPair);%0A    %7D%0A   %0A    // Tricky.%0A    void addNodeToStack(Stack%3CTreeNode%3E swapPair, TreeNode root) %7B%0A        int sz = swapPair.size();%0A        if (sz == 0) %7B%0A            swapPair.push(root);%0A        %7D else if (sz == 1) %7B%0A            if (root.val %3E= swapPair.peek().val) %7B%0A                swapPair.pop();%0A            %7D%0A            swapPair.push(root);%0A        %7D else if (sz == 2) %7B%0A            if (root.val %3C swapPair.peek().val) %7B%0A                swapPair.pop();%0A                swapPair.push(root);%0A            %7D%0A        %7D %0A    %7D%0A%7D%0A

Create Recover_Binary_Search_Tree.java