106. Construct Binary Tree from Inorder and Postorder Traversal
Practice Construct Binary Tree from Inorder and Postorder Traversal for free on NudgeCode: Medium, Binary Tree pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
You get the inorder and the postorder traversal of the same binary tree. All values are distinct. Rebuild the tree and return its root.
Example
inorder = [9,3,15,20,7], postorder = [9,15,7,20,3] -> [3,9,20,null,null,15,7]
Constraints
- 1 <= inorder.length <= 3000
- postorder.length == inorder.length
- -3000 <= values <= 3000
- all values are unique
- both arrays describe the same tree