Given preorder and inorder traversal of a tree, write a program to construct the binary tree using the preorder and inorder traversal.
Problem Note
- You may assume that duplicates do not exist in the tree.
Example
Input:
preorder = [4, 7, 10, 15, 7]
inorder = [7, 4, 15, 10, 7]
Output: Return the following binary tree:
4
/ \
7 10
/ \
15 7