0106. Construct Binary Tree from Inorder and Postorder Traversal
Previous0105. Construct Binary Tree from Preorder and Inorder TraversalNext0107. Binary Tree Level Order Traversal II
Last updated
Last updated
https://leetcode.com/problems/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:
1 <= inorder.length <= 3000
postorder.length == inorder.length
-3000 <= inorder[i], postorder[i] <= 3000
inorder
and postorder
consist of unique values.
Each value of 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.