Construct Tree from Preorder+Inorder

00:00
MediumSee topic tags for pattern hints
AmazonMicrosoft

Implement Build tree from preorder and inorder traversal. Return the expected result as described.

Examples

Input → Ex1: See problem description for sample input/output.
Output →
Input → Ex2: Edge case: empty or single element input.
Output →