React's Virtual DOM represents the UI as a tree. During server-side rendering (SSR) hydration, the client receives serialized flat arrays of components. To rebuild the exact component hierarchy in memory, the hydration engine processes preorder (root first) and inorder (left, root, right) traversal logs.
Given two integer arrays `preorder` and `inorder` where `preorder` is the preorder traversal of a binary tree and `inorder` is the inorder traversal of the same tree, construct and return the binary tree.
βΆ Run Code to test against examples Β· Submit to judge all 5 test cases