Skip to content

Commit ff09bff

Browse files
committed
review: construct binary tree from preorder and inorder traversal
1 parent 4f38c55 commit ff09bff

File tree

1 file changed

+0
-4
lines changed
  • construct-binary-tree-from-preorder-and-inorder-traversal

1 file changed

+0
-4
lines changed

construct-binary-tree-from-preorder-and-inorder-traversal/wogha95.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ var buildTree = function (preorder, inorder) {
1919
return null;
2020
}
2121

22-
if (inorder.length === 1) {
23-
return new TreeNode(inorder[0]);
24-
}
25-
2622
const rootValue = preorder[0];
2723
const leftNodeLength = inorder.findIndex((value) => value === rootValue);
2824
const leftNode = buildTree(

0 commit comments

Comments
 (0)