@@ -0,0 +1,655 @@
+import java.util.List;%0A%0Apublic class ReconstructPreorder %7B%0A    public static Integer subtreeIdx = 0;%0A%0A    public static BinaryTreeNode%3CInteger%3E reconstructPreorder(List%3CInteger%3E preorder) %7B%0A        subtreeIdx = 0;%0A        return helper(preorder);%0A    %7D%0A%0A    public static BinaryTreeNode%3CInteger%3E helper(List%3CInteger%3E preorder) %7B%0A        Integer subKey = preorder.get(subtreeIdx);%0A        subtreeIdx++;%0A        if (subKey == null) %7B%0A            return null;%0A        %7D%0A        BinaryTreeNode%3CInteger%3E left = helper(preorder);%0A        BinaryTreeNode%3CInteger%3E right = helper(preorder);%0A        return new BinaryTreeNode%3CInteger%3E(subKey, left, right);%0A    %7D%0A%7D%0A

reconstruct preorder