@@ -0,0 +1,1042 @@
+public class _0105ConstructBinaryTreeFromPreorderAndInorderTraversal %7B%0A  public TreeNode buildTree(int%5B%5D preorder, int%5B%5D inorder) %7B%0A    if (preorder == null %7C%7C preorder.length == 0) %7B%0A      return null;%0A    %7D%0A    return buildTree(preorder, 0, inorder, 0, preorder.length);%0A  %7D%0A%0A  private TreeNode buildTree(int%5B%5D preorder, int i, int%5B%5D inorder, int start, int end) %7B%0A    TreeNode node = new TreeNode(preorder%5Bi%5D);%0A    int index = findIndex(inorder, start, end, preorder%5Bi%5D);%0A    if (index %3E start) %7B%0A      node.left = buildTree(preorder, i + 1, inorder, start, index);%0A    %7D%0A    if (index %3C end - 1) %7B%0A      node.right = buildTree(preorder, i + index - start + 1, inorder, index + 1, end);%0A    %7D%0A    return node;%0A  %7D%0A%0A  private int findIndex(int%5B%5D inorder, int start, int end, int value) %7B%0A    for (int i = start; i %3C end; i++) %7B%0A      if (inorder%5Bi%5D == value) %7B%0A        return i;%0A      %7D%0A    %7D%0A    return -1;%0A  %7D%0A  %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%7D%0A

Add _0105ConstructBinaryTreeFromPreorderAndInorderTraversal