Construct Binary Tree from Preorder and Inorder Traversal

Given preorder and inorder traversals of a tree with unique values, construct the tree and return its level-order array. The array lists nodes level by level from left to right, uses null for a missing child, and omits trailing null entries. Since all values are unique and the traversals describe the same tree, the reconstruction is unique.

Examples
Input: [[3,9,20,15,7],[9,3,15,20,7]]
Output: [3,9,20,null,null,15,7]
Hints
Related Problems

Construct Binary Tree from Preorder and Inorder Traversal

Given preorder and inorder traversals of a tree with unique values, construct the tree and return its level-order array. The array lists nodes level by level from left to right, uses `null` for a missing child, and omits trailing `null` entries. Since all values are unique and the traversals describe the same tree, the reconstruction is unique.