@@ -0,0 +1,1620 @@
+package leetcode.construct_binary_tree_from_inorder_and_postorder_traversal;%0A%0Aimport common.TreeNode;%0A%0Apublic class Solution %7B%0A%09public TreeNode buildTree(int%5B%5D inorder, int%5B%5D postorder, int in_from, int in_to, int post_from, int post_to)%7B%0A%09%09if(in_from == in_to %7C%7C post_from == post_to) return null;%0A%09%09int rootval = postorder%5Bpost_to - 1%5D;%0A%09%09TreeNode root = new TreeNode(rootval);%0A%09%09int rootidx;%0A%09%09for(rootidx = in_from; rootidx %3C in_to && inorder%5Brootidx%5D != rootval; rootidx++);%0A%09%09root.left = buildTree(inorder, postorder, in_from, rootidx, post_from, post_from + (rootidx - in_from));%0A%09%09root.right = buildTree(inorder, postorder, rootidx + 1, in_to, post_to - (in_to - rootidx), post_to - 1);%0A%09%09return root;%0A%09%7D%0A    public TreeNode buildTree(int%5B%5D inorder, int%5B%5D postorder) %7B%0A    %09if(inorder == null %7C%7C postorder == null) return null;%0A    %09return buildTree(inorder, postorder, 0, inorder.length, 0, postorder.length);%0A    %7D%0A    %0A    public static void inOrder(TreeNode cur)%7B%0A    %09if(cur != null)%7B%0A    %09%09inOrder(cur.left);%0A    %09%09System.err.print(cur.val + %22-%3E%22);%0A    %09%09inOrder(cur.right);%0A    %09%7D%0A    %7D%0A    %0A    public static void postOrder(TreeNode cur)%7B%0A    %09if(cur != null)%7B%0A    %09%09postOrder(cur.left);%0A    %09%09postOrder(cur.right);%0A    %09%09System.err.print(cur.val + %22-%3E%22);%0A    %09%7D%0A    %7D%0A    %0A    public static void main(String%5B%5D args)%7B%0A    %09int%5B%5D inorder = new int%5B%5D%7B4, 9, 5, 1, 8, 3, 7, 6%7D;%0A    %09int%5B%5D postorder = new int%5B%5D%7B9, 4, 5, 8, 7, 6, 3, 1%7D;%0A    %09TreeNode ret = new Solution().buildTree(inorder, postorder);%0A    %09inOrder(ret);%0A    %09System.err.println(%22%22);%0A    %09postOrder(ret);%0A    %09System.err.println(%22%22);%0A    %7D%0A%7D%0A

Add java solution for 106. Construct Binary Tree from Inorder and Postorder Traversal