Construct Binary Tree From Inorder And Preorder

Given preorder and inorder traversal of a tree, construct the binary tree.

Note: You may assume that duplicates do not exist in the tree.

Example :

Input :
        Preorder : [1, 2, 3]
        Inorder  : [2, 1, 3]

Return :
            1
           / \
          2   3

Interview Code Editor
Hints
  • Solution Approach
  • Complete Solution
2988 successful submissions.
Asked In:
  • Amazon
  • Microsoft
Click here to jump start your coding interview preparation