Build Binary Tree from Preorder and Inorder Traversal

IF
AlgoAxiomStaff Engineers
JSTS
Medium20 mins

Given two integer arrays preorder and inorder representing the preorder and inorder traversal of a binary tree, construct and return the binary tree.

Source: Tree Depth-First Search pattern — AlgoAxiom
JavaScript
Test Case 1
root = [1, 2, 3]
Test Case 2
root = [1, 2, 3, 4, 5]
Idle