We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4f38c55 commit ff09bffCopy full SHA for ff09bff
construct-binary-tree-from-preorder-and-inorder-traversal/wogha95.js
@@ -19,10 +19,6 @@ var buildTree = function (preorder, inorder) {
19
return null;
20
}
21
22
- if (inorder.length === 1) {
23
- return new TreeNode(inorder[0]);
24
- }
25
-
26
const rootValue = preorder[0];
27
const leftNodeLength = inorder.findIndex((value) => value === rootValue);
28
const leftNode = buildTree(
0 commit comments