The first element of preorder is the root. Find this root in inorder to determine left and right subtrees.
Root = preorder[0].
Find root's index in inorder. Elements to the left form the left subtree. Elements to the right form the right subtree.
Recursively build left subtree with corresponding preorder and inorder slices.
Recursively build right subtree similarly.
Use a hashmap for root lookup in inorder.