| Topic | Difficulty | Companies |
|---|---|---|
| Binary Tree | MEDIUM | Amazon Google |
Given preorder and inorder traversal of a tree, write a program to construct the binary tree using the preorder and inorder traversal.
Problem Note
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