Medium
,Tree
,Array
,Hash Table
,Divide and Conquer
106. Construct Binary Tree from Inorder and Postorder Traversal
Given two integer arrays inorder
and postorder
where inorder
is the inorder traversal of a binary tree and postorder
is the postorder traversal of the same tree, construct and return the binary tree.
Example 1:
Example 2:
Constraints:
inorder.length
<= 3000postorder.length
== inorder.length
inorder[i]
, postorder[i]
<= 3000inorder
and postorder
consist of unique values.postorder
also appears in inorder
.inorder
is guaranteed to be the inorder traversal of the tree.postorder
is guaranteed to be the postorder traversal of the tree.Ron Chen Thu, Mar 16, 2023
MarsgoatMar 17, 2023