Construct a Tree From Preorder and Inorder
Medium · Trees · about 25 minutes
Asked at Microsoft, Amazon, Bloomberg, Google.
Given two integer arrays preorder and inorder — the preorder and inorder traversals of the same binary tree with unique values — rebuild the tree and return its root.