@@ -0,0 +1,1578 @@
+/**%0A *%09Invert a binary tree.%0A *%0A *    %09  4%0A *  %09/   %5C%0A * %09   2     7%0A * %09  / %5C   / %5C%0A *%09 1   3 6   9%0A *%0A *  to%0A *%0A *       4%0A *     /   %5C%0A *    7     2%0A *%09 / %5C   / %5C%0A *%099   6 3   1%0A *%0A *%09Trivia:%0A *%09This problem was inspired by this original tweet by Max Howell:%0A *%09Google: 90%25 of our engineers use the software you wrote (Homebrew), but you can%E2%80%99t invert a binary tree on a whiteboard so fuck off.%0A *%0A *%09Author: matao%0A *%0A */%0A%0Aclass TreeNode %7B%0A%09int val;%0A%09TreeNode left;%0A%09TreeNode right;%0A%09TreeNode(int x) %7B val = x; %7D%0A%7D%0A%0Apublic class InvertBinaryTree %7B%0A%09public static TreeNode invertTree(TreeNode root) %7B%0A%09%09if (root == null) %7B%0A%09%09%09return null;%0A%09%09%7D%0A%09%09TreeNode tmp = root.left;%0A%09%09root.left = root.right;%0A%09%09root.right = tmp;%0A%0A%09%09root.left = invertTree(root.left);%0A%09%09root.right = invertTree(root.right);%0A%0A%09%09return root;%0A    %7D%0A%0A    public static void traversePreOrder(TreeNode root) %7B%0A    %09if(root == null) %7B%0A    %09%09return;%0A    %09%7D%0A    %09System.out.print(root.val + %22 %22);%0A    %09traversePreOrder(root.left);%0A    %09traversePreOrder(root.right);%0A    %7D%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09TreeNode node4 = new TreeNode(4);%09%09%0A%09%09TreeNode node2 = new TreeNode(2);%09%09%0A%09%09TreeNode node7 = new TreeNode(7);%09%09%0A%09%09TreeNode node1 = new TreeNode(1);%09%09%0A%09%09TreeNode node3 = new TreeNode(3);%09%09%0A%09%09TreeNode node6 = new TreeNode(6);%09%09%0A%09%09TreeNode node9 = new TreeNode(9);%09%09%0A%0A%09%09node4.left = node2;%0A%09%09node4.right = node7;%0A%0A%09%09node2.left = node1;%0A%09%09node2.right = node3;%0A%0A%09%09node7.left = node6;%0A%09%09node7.right = node9;%0A%0A%09%09traversePreOrder(node4);%0A%0A%09%09System.out.println();%0A%0A%09%09traversePreOrder(invertTree(node4));%0A%09%7D%0A%7D

add Invert Binary Tree solution